facet

How to change facet labels?

允我心安 提交于 2019-11-26 03:19:03
问题 I have used the following ggplot command: ggplot(survey, aes(x = age)) + stat_bin(aes(n = nrow(h3), y = ..count.. / n), binwidth = 10) + scale_y_continuous(formatter = \"percent\", breaks = c(0, 0.1, 0.2)) + facet_grid(hospital ~ .) + theme(panel.background = theme_blank()) to produce I\'d like to change the facet labels, however, to something shorter (like Hosp 1 , Hosp 2 ...) because they are too long now and look cramped (increasing the height of the graph is not an option, it would take

Setting individual axis limits with facet_wrap and scales = “free” in ggplot2

别说谁变了你拦得住时间么 提交于 2019-11-26 02:18:59
问题 I\'m creating a facetted plot to view predicted vs. actual values side by side with a plot of predicted value vs. residuals. I\'ll be using shiny to help explore the results of modeling efforts using different training parameters. I train the model with 85% of the data, test on the remaining 15%, and repeat this 5 times, collecting actual/predicted values each time. After calculating the residuals, my data.frame looks like this: head(results) act pred resid 2 52.81000 52.86750 -0.05750133 3