All Projects → nsgrantham → Ggdark

nsgrantham / Ggdark

Licence: other
Dark mode for ggplot2 themes

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to Ggdark

R4ds Exercise Solutions
Exercise solutions to "R for Data Science"
Stars: ✭ 226 (+76.56%)
Mutual labels:  tidyverse, ggplot2
r-whatsapp-analysis-parte1
Análisis de texto y visualización de datos con R, de conversaciones de WhatsApp, primer parte. Uso de librería rwhatsapp.
Stars: ✭ 22 (-82.81%)
Mutual labels:  ggplot2, tidyverse
Data Science Toolkit
Collection of stats, modeling, and data science tools in Python and R.
Stars: ✭ 169 (+32.03%)
Mutual labels:  tidyverse, ggplot2
TidyTuesday
📊 Collection of #TidyTuesday Visualisations! 📈
Stars: ✭ 59 (-53.91%)
Mutual labels:  ggplot2, tidyverse
Tidytuesday
📊 My contributions to the #TidyTuesday challenge
Stars: ✭ 410 (+220.31%)
Mutual labels:  tidyverse, ggplot2
Tidymv
Tidy Model Visualisation for Generalised Additive Models
Stars: ✭ 25 (-80.47%)
Mutual labels:  tidyverse, ggplot2
CSSS508
CSSS508: Introduction to R for Social Scientists
Stars: ✭ 28 (-78.12%)
Mutual labels:  ggplot2, tidyverse
R4Econ
R Code Examples Multi-dimensional/Panel Data
Stars: ✭ 16 (-87.5%)
Mutual labels:  ggplot2, tidyverse
parcours-r
Valise pédagogique pour la formation à R
Stars: ✭ 25 (-80.47%)
Mutual labels:  ggplot2, tidyverse
Moderndive book
Statistical Inference via Data Science: A ModernDive into R and the Tidyverse
Stars: ✭ 527 (+311.72%)
Mutual labels:  tidyverse, ggplot2
Ggplot Courses
👨‍🏫 ggplot2 Teaching Material
Stars: ✭ 40 (-68.75%)
Mutual labels:  tidyverse, ggplot2
Ggbernie
A ggplot2 geom for adding Bernie Sanders to ggplot2
Stars: ✭ 96 (-25%)
Mutual labels:  ggplot2
Tidylo
Weighted tidy log odds ratio ⚖️
Stars: ✭ 62 (-51.56%)
Mutual labels:  tidyverse
Ggthemes
Additional themes, scales, and geoms for ggplot2
Stars: ✭ 1,107 (+764.84%)
Mutual labels:  ggplot2
Esquisse
RStudio add-in to make plots with ggplot2
Stars: ✭ 1,097 (+757.03%)
Mutual labels:  ggplot2
Pkgverse
📦🔭🌠 Create your own universe of packages à la tidyverse
Stars: ✭ 108 (-15.62%)
Mutual labels:  tidyverse
Ggmcmc
Graphical tools for analyzing Markov Chain Monte Carlo simulations from Bayesian inference
Stars: ✭ 95 (-25.78%)
Mutual labels:  ggplot2
Colormap
R package to generate colors from a list of 44 pre-defined palettes
Stars: ✭ 55 (-57.03%)
Mutual labels:  ggplot2
R for data science
Materials for teaching R and tidyverse
Stars: ✭ 54 (-57.81%)
Mutual labels:  tidyverse
Ggeconodist
📉 Create Diminutive Distribution Charts
Stars: ✭ 53 (-58.59%)
Mutual labels:  ggplot2

ggdark

Travis-CI Build Status AppVeyor Build Status

Installation

You can install ggdark from CRAN with:

install.packages("ggdark")

If you want the development version, you can install ggdark from GitHub with:

# install.packages("devtools")
devtools::install_github("nsgrantham/ggdark")

Dark mode for ggplot2

library(ggplot2)

p <- ggplot(diamonds) + 
  geom_point(aes(carat, price, color = cut)) + 
  scale_y_continuous(label = scales::dollar) +
  guides(color = guide_legend(reverse = TRUE)) +
  labs(title = "Prices of 50,000 round cut diamonds by carat and cut",
       x = "Weight (carats)",
       y = "Price in US dollars",
       color = "Quality of the cut")

p + theme_gray()  # ggplot default

library(ggdark)

p + dark_theme_gray()  # the dark version
#> Inverted geom defaults of fill and color/colour.
#> To change them back, use invert_geom_defaults().

# modify the theme to your liking, as you would in ggplot2
p + dark_theme_gray(base_family = "Fira Sans Condensed Light", base_size = 14) + 
  theme(plot.title = element_text(family = "Fira Sans Condensed"),
        plot.background = element_rect(fill = "grey10"),
        panel.background = element_blank(),
        panel.grid.major = element_line(color = "grey30", size = 0.2),
        panel.grid.minor = element_line(color = "grey30", size = 0.2),
        legend.background = element_blank(),
        axis.ticks = element_blank(),
        legend.key = element_blank(),
        legend.position = c(0.815, 0.27))

Dark themes

ggdark provides dark versions of all themes available in ggplot2:

mtcars2 <- within(mtcars, {
  vs <- factor(vs, labels = c("V-shaped", "Straight"))
  am <- factor(am, labels = c("Automatic", "Manual"))
  cyl  <- factor(cyl)
  gear <- factor(gear)
})

p <- ggplot(mtcars2) +
  geom_point(aes(wt, mpg, color = gear)) +
  facet_grid(vs ~ am) +
  labs(title = "Fuel economy declines as weight increases",
       subtitle = "(1973-74)",
       caption = "Data from the 1974 Motor Trend US magazine.",
       x = "Weight (1000 lbs)",
       y = "Fuel economy (mpg)",
       color = "Gears")
p + dark_theme_gray()

p + dark_theme_bw()

p + dark_theme_linedraw()

p + dark_theme_light()  # quite dark

p + dark_theme_dark()  # quite light

p + dark_theme_minimal()

p + dark_theme_classic()

p + dark_theme_void()

Make your own dark theme

Usedark_mode on any theme to create its dark version.

invert_geom_defaults()  # change geom defaults back to black

library(gapminder)

p <- ggplot(subset(gapminder, continent != "Oceania")) +
  geom_line(aes(year, lifeExp, group = country, color = country), lwd = 1, show.legend = FALSE) + 
  facet_wrap(~ continent) +
  scale_color_manual(values = country_colors) +
  labs(title = "Life expectancy has increased worldwide")
# install.packages("ggthemes")
library(ggthemes)

p + theme_fivethirtyeight()

p + dark_mode(theme_fivethirtyeight())
#> Inverted geom defaults of fill and color/colour.
#> To change them back, use invert_geom_defaults().

invert_geom_defaults()  # leave the geom defaults how you found them!

Happy plotting! 🖤

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].