plot - Plotting multiple histograms quickly in R -
for exploratory analysis, useful plot multiple variables in 1 grid. easy way to:
hist(mtcars[c(1,2,3,4)]) however, becomes difficult adjust breaks , axes maintain consistency i.e.
hist(mtcars[c(1,2,3,4)], breaks = 10) does not effect histograms. there easy work around or easy way in ggplot2?
this how hist() :
lapply(mtcars[1:4], fun=hist) however prefer store plots in r objects ggplot2 , display plot lists cowplot::plotgrid() :
list <-lapply(1:ncol(mtcars), function(col) ggplot2::qplot(mtcars[[col]], geom = "histogram", binwidth = 1)) cowplot::plot_grid(plotlist = list)
Comments
Post a Comment