Marc Kupietz | 5214481 | 2020-12-14 23:41:56 +0100 | [diff] [blame^] | 1 | library(ggplot2) |
| 2 | library(idsThemeR) |
| 3 | |
| 4 | if (interactive()) { |
| 5 | p <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg, |
| 6 | colour = factor(gear))) + facet_wrap(~am) |
| 7 | p + theme_ids() + scale_colour_ids() |
| 8 | p + theme_ids(style = "dark") + |
| 9 | scale_colour_ids("dark") |
| 10 | |
| 11 | dtemp <- data.frame(Months = factor(rep(substr(month.name, 1, 3), 4), |
| 12 | levels = substr(month.name, 1, 3)), |
| 13 | City = rep(c("Tokyo", "New York", "Berlin", "London"), |
| 14 | each = 12), |
| 15 | Temperature = c(7.0, 6.9, 9.5, 14.5, 18.2, 21.5, |
| 16 | 25.2, 26.5, 23.3, 18.3, 13.9, 9.6, |
| 17 | -0.2, 0.8, 5.7, 11.3, 17.0, 22.0, |
| 18 | 24.8, 24.1, 20.1, 14.1, 8.6, 2.5, |
| 19 | -0.9, 0.6, 3.5, 8.4, 13.5, 17.0, |
| 20 | 18.6, 17.9, 14.3, 9.0, 3.9, 1.0, |
| 21 | 3.9, 4.2, 5.7, 8.5, 11.9, 15.2, |
| 22 | 17.0, 16.6, 14.2, 10.3, 6.6, 4.8)) |
| 23 | |
| 24 | ggplot(dtemp, aes(x = Months, y = Temperature, group = City, color = City)) + |
| 25 | geom_line() + |
| 26 | geom_point(size = 1.1) + |
| 27 | ggtitle("Monthly Average Temperature", subtitle="Source: WorldClimate.com") + |
| 28 | theme_ids() + |
| 29 | scale_colour_ids() |
| 30 | |
| 31 | } |
| 32 | |