cowplot

Merge and Perfectly Align Histogram and Boxplot using ggplot2

天大地大妈咪最大 提交于 2019-11-26 22:47:29
since yesterday I am reading answers and websites in order to combine and align in one plot an histogram and a boxplot generated using ggplot2 package. This question differs from others because the boxplot chart needs to be reduced in height and aligned to the left outer margin of the histogram . Considering the following dataset: my_df <- structure(list(id = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,

Merge and Perfectly Align Histogram and Boxplot using ggplot2

匆匆过客 提交于 2019-11-26 09:10:33
问题 since yesterday I am reading answers and websites in order to combine and align in one plot an histogram and a boxplot generated using ggplot2 package. This question differs from others because the boxplot chart needs to be reduced in height and aligned to the left outer margin of the histogram . Considering the following dataset: my_df <- structure(list(id = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36

Cowplot made ggplot2 theme disappear / How to see current ggplot2 theme, and restore the default?

拜拜、爱过 提交于 2019-11-26 08:35:01
问题 I recently installed the cowplot package. However, after doing this I noticed that my ggplots are missing their background and grid lines of theme_grey() ! The code to create each of the above plots is: result_df %>% ggplot(aes_string(x = \'p\', y = \'r\')) + # theme_grey() + # uncomment this line to produce plot on right geom_point(aes(group = c), size = 0.5) + geom_line(aes(group = c), size = 0.2, linetype = \'dotted\') + theme(axis.text.x=element_text(angle = 90, hjust = 1, vjust = 0.5)) +

Multiple plots in for loop ignoring par

隐身守侯 提交于 2019-11-26 02:02:55
问题 I am trying to generate 10 pairs of plots with a few pairs per page of plots, and am using a for loop to construct the pairs. However, the plots are sent to the device as separate plots instead of pages. The MWE below has identical constructions for base graphics and ggplot versions, but the base graphics works and ggplot does not. What do I need to do to get the pagination correct in the second version? library(ggplot2) attach(mtcars) # correct configuration par(mfrow=c(2,2)) for (ii in 1:3)