## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup--------------------------------------------------------------------
suppressPackageStartupMessages(require(dplyr))
suppressPackageStartupMessages(require(data.table))
suppressPackageStartupMessages(require(ggplot2))
suppressPackageStartupMessages(require(FinanceGraphs))

## ----echo=FALSE---------------------------------------------------------------
options(datatable.print.keys=FALSE, datatable.print.class=FALSE)
knitr::opts_chunk$set(fig.width = 7)

## -----------------------------------------------------------------------------
fg_get_aes("lines", n_max=6)

## -----------------------------------------------------------------------------
print(fg_print_aes_list("fg_eventStudy"))

## -----------------------------------------------------------------------------
fg_get_aes("espath_ls", n_max=6)

## -----------------------------------------------------------------------------
fg_display_colors("lines")

## -----------------------------------------------------------------------------
onedt <- function(offset,category) { data.table(x=seq(1,10),y=seq(1,10)-offset,id=rep(category,10))}
exampledta <- rbind(onedt(0,"A"),onedt(1,"B"),onedt(2,"C"))
fg_scatplot(exampledta,"y ~ x + color:id",title="default",psize=6)

## -----------------------------------------------------------------------------
head(oldcolors <- fg_get_aes("lines"),3)
oldcolors[c(1,2,3),"value"] <- alpha("blue", c(1,0.6,0.3))
# Note that we still keep "category" as "lines".  To add a new set, use a different name.
fg_update_aes( oldcolors )
fg_display_colors("lines")

## -----------------------------------------------------------------------------
fg_scatplot(exampledta,"y ~ x + color:id",title="default",psize=6)

## -----------------------------------------------------------------------------
oldcolors[c(1,2,3),"value"] <- alpha("red", c(1,0.6,0.3))
oldcolors[c(1,2,3),"category"] <- rep("MyNewColors",3)
fg_update_aes( oldcolors )
fg_scatplot(exampledta,"y ~ x + color:id,MyNewColors",title="with new colors",psize=6)

## -----------------------------------------------------------------------------
fg_replace_theme(theme_dark())
fg_scatplot(exampledta,"y ~ x + color:id,MyNewColors",title="New Theme, New Colors",psize=6)

## -----------------------------------------------------------------------------
fg_reset_to_default_state("all")
fg_scatplot(exampledta,"y ~ x + color:id",title="Back to old colors",psize=6)

