项目作者: jrnold

项目描述 :
ggplot2的其他主题,比例和地理位置
高级语言: R
项目地址: git://github.com/jrnold/ggthemes.git


R-CMD-check
Code Coverage
Status
rstudio mirror
downloads
CRAN
status
lifecycle

Some extra geoms, scales, and themes for
ggplot.

Install

To install the stable version from CRAN,

  1. install.packages('ggthemes', dependencies = TRUE)

Or, to install the development version from github, use the devtools
package,

  1. library("devtools")
  2. install_github(c("hadley/ggplot2", "jrnold/ggthemes"))

How to use

For a quick tutorial, check out Rafael Irizarry’s
book
.

Examples

  1. library("ggplot2")
  2. library("ggthemes")
  3. mtcars2 <- within(mtcars, {
  4. vs <- factor(vs, labels = c("V-shaped", "Straight"))
  5. am <- factor(am, labels = c("Automatic", "Manual"))
  6. cyl <- factor(cyl)
  7. gear <- factor(gear)
  8. })
  9. p1 <- ggplot(mtcars2) +
  10. geom_point(aes(x = wt, y = mpg, colour = gear)) +
  11. labs(
  12. title = "Fuel economy declines as weight increases",
  13. subtitle = "(1973-74)",
  14. caption = "Data from the 1974 Motor Trend US magazine.",
  15. x = "Weight (1000 lbs)",
  16. y = "Fuel economy (mpg)",
  17. colour = "Gears"
  18. )
  1. p1 +
  2. scale_color_calc() +
  3. theme_calc()

  1. p1 + theme_clean()

  1. p1 + theme_economist() +
  2. scale_colour_economist()

  1. p1 + theme_excel() +
  2. scale_colour_excel()

  1. p1 + theme_excel_new() +
  2. scale_colour_excel_new()

  1. p1 + theme_igray()

  1. p1 + theme_par()

  1. p1 + theme_fivethirtyeight()

  1. p1 + theme_few() +
  2. scale_colour_few()

  1. p1 + theme_solarized() +
  2. scale_colour_solarized()

  1. p1 + theme_solarized(light=FALSE) +
  2. scale_colour_solarized()

  1. p1 + theme_solid()

  1. p1 + theme_tufte()

  1. p1 + theme_wsj(base_size = 8) + scale_color_wsj()

  1. p1 + scale_color_colorblind()

  1. p1 + scale_color_tableau()