data(txhousing, package = "ggplot2")
cities <- c("Houston", "Fort Worth", "San Antonio", "Dallas", "Austin")
df <- subset(txhousing, city %in% cities)
d <- ggplot2::ggplot(data = df, ggplot2::aes(x = sales, y = median)) +
ggplot2::geom_point(ggplot2::aes(colour = city))
# Plot with a qualitative theme
d + scale_color_theme("Set 1")
# Use a sequential theme as a discrete scale
d + scale_color_theme("SunsetDark", discrete = TRUE)
data(faithfuld, package = "ggplot2")
v <- ggplot2::ggplot(faithfuld) +
ggplot2::geom_tile(ggplot2::aes(waiting, eruptions, fill = density))
# Plot with continuous themes
v + scale_fill_theme("Plasma")
# Use a diverging theme with a specified midpoint
v + scale_fill_theme("midr", middle = 0.017)
Run the code above in your browser using DataLab