| fg_update_aes | R Documentation |
fg_update_aes() updates or replaces default aesthestics (e.g. colors, linestyles, etc).
fg_update_line_colors() replaces line colors only
fg_reset_to_default_state() resets colors and/or dates of interest
fg_replace_theme() Replaces default theme used in static plots
fg_verbose() Toggles printing of aesthetics
fg_update_aes(indta, aestype = NA_character_, persist = TRUE, replace = FALSE)
fg_update_line_colors(colorlist, replace = FALSE, persist = TRUE)
fg_replace_theme(newTheme, persist = TRUE)
fg_verbose(item = "")
fg_reset_to_default_state(reset = "all")
indta |
|
aestype |
(Default: |
persist |
(Default: TRUE) Keep changes across invocations of the package. |
replace |
(Default: FALSE) Replaces existing dates of interest with new set provided, otherwise replaces/inserts new rows only. |
colorlist |
List with up to 14 new colors just for line (series) coloring |
newTheme |
A new ggplot2 theme |
item |
(Default: "") A grep string for categories desired. |
reset |
(Default: "all"), options in ("all","colors","doi") to reset to defaults with the package. |
For colors,
New data passed into fg_update_aes() persists across future loads of the package unless persist=FALSE.
New color datasets must have at least three columns:
| Column | Meaning |
category | Arbitrary aestehtic category, e.g. "lines" for line colors. |
variable | Any string that can be sorted or grepped to map to data. |
type | Aesthetic type, in c("color","colorrange","linetype","symbol","alpha") |
value | String with value detired (e.g a color) |
variable is used to prioritize colors, so (e.g. D01 will be the color of the first series in an input dataset)
If aestype=="colorrange" then a sequential scale of size n_max will be returned using details saved from fg_update_aes(). See scales::brewer_pal
and colorbrewer
No return value, as these are called for the side effects of adding to or replacing aesthetic sets.
fgts_dygraph(), fg_scatplot(), fg_get_aes()
# Data set, String
head(oldcolors <- fg_get_aes("lines"),3)
# then change as needed. For example, to make the second line blue, and the 4th line red,
oldcolors[c(2,3),"value"] <- c("blue","tomato")
fg_update_aes( oldcolors )
head( fg_get_aes("lines"),3)
# to create a new category, make a similar `data.frame`, as in
newcolors <- data.frame(category=rep("mylines",3),variable=c("D01","D02","D03"),
value=c("red","black","green"))
fg_update_aes( newcolors, aestype="color")
fg_get_aesstring("mylines")
#Theme replacement
require(ggplot2)
fg_replace_theme(ggplot2::theme_dark(),persist=FALSE)
fg_reset_to_default_state("all")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.