Русские видео

Сейчас в тренде

Иностранные видео


Скачать с ютуб Modify Scientific Notation on ggplot2 Plot Axis in R | Change Labels | scales & stringr Packages в хорошем качестве

Modify Scientific Notation on ggplot2 Plot Axis in R | Change Labels | scales & stringr Packages 3 года назад


Если кнопки скачивания не загрузились НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием, пожалуйста напишите в поддержку по адресу внизу страницы.
Спасибо за использование сервиса savevideohd.ru



Modify Scientific Notation on ggplot2 Plot Axis in R | Change Labels | scales & stringr Packages

How to change the scientific notation on the axis of a ggplot2 plot in the R programming language. More details: https://statisticsglobe.com/modify-sc... R code of this video: set.seed(354678) # Create random example data data <- data.frame(x = rnorm(1000, 10000000, 1000000)) install.packages("ggplot2") # Install ggplot2 package library("ggplot2") # Load ggplot2 package ggp <- ggplot(data, aes(x = x)) + # Create ggplot2 plot with default axes geom_density() ggp # Draw ggplot2 plot with default axes install.packages("scales") # Install & load scales library("scales") ggp + # Modify axes using scales package scale_x_continuous(labels = unit_format(unit = "e+06", scale = 1 / 1e+06, digits = 2)) install.packages("stringr") # Install & load stringr library("stringr") formatCustomSci <- function(x) { # Create user-defined function x_sci <- str_split_fixed(formatC(x, format = "e"), "e", 2) alpha <- as.numeric(x_sci[ , 1]) power <- as.integer(x_sci[ , 2]) paste(alpha * 10, power - 1L, sep = "e") } ggp + # Modify axes using user-defined function scale_x_continuous(labels = formatCustomSci) Follow me on Social Media: Facebook – Statistics Globe Page:   / statisticsglobecom   Facebook – Group for Discussions & Questions:   / statisticsglobe   LinkedIn – Statistics Globe Page:   / statisticsglobe   LinkedIn – Group for Discussions & Questions:   / 12555223   Twitter:   / joachimschork   Music by bensound.com

Comments