We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Now that #19 adds a custom ggplot theme, let's also add color scales to be able to easily use the 2dii color palette. Something like...
library(ggplot2) library(r2dii.ggplot) r2dii_pal <- function() { values <- r2dii_palette_colours()$colour_hex max_n <- length(values) f <- scales:::manual_pal(values) attr(f, "max_n") <- max_n f } scale_colour_r2dii <- function(...) { discrete_scale("colour", "r2dii", r2dii_pal(), ...) } scale_color_r2dii <- scale_colour_r2dii scale_fill_r2dii <- function(...) { discrete_scale("fill", "r2dii", r2dii_pal(), ...) } scatter <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg, colour = factor(gear))) + facet_wrap(~am) + ggtitle("Diamond Prices") scatter_r2dii <- scatter + theme_2dii_ggplot() + scale_color_r2dii() bar <- ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) + geom_bar() bar_r2dii <- bar + theme_2dii_ggplot() + scale_fill_r2dii() gridExtra::grid.arrange(scatter, scatter_r2dii, bar, bar_r2dii, nrow = 2)
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Now that #19 adds a custom ggplot theme, let's also add color scales to be able to easily use the 2dii color palette. Something like...
The text was updated successfully, but these errors were encountered: