require("ggconventions")
# create gender convention function
as_convention_redblack <- function(x) {
y = ifelse(x < 0, "Red", "Black")
class(y) <- c("convention", class(y))
attr(y, "convention") <- "redblack"
y
}
as_convention_profit <- as_convention_redblack
as_convention_balance <- as_convention_redblack
# create scales for our conventions
scale_colour_redblack <- function(...) {
scale_colour_manual(...,
values=c("Red"="red", "Black"="black"), guide="none")
}
scale_fill_redblack <- function(...) {
scale_fill_manual(...,
values=c("Red"="red", "Black"="black"), guide="none")
}
scale_shape_redblack <- function(...) { scale_shape_discrete(...) }
scale_x_redblack <- function(...) { scale_x_discrete(...) }
scale_y_redblack <- function(...) { scale_y_discrete(...) }
scale_linetype_redblack <- function(...) { scale_linetype_discrete(...) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.