## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 7, fig.asp = 0.618, fig.align = "center", warning = FALSE, message = FALSE ) ## ----setup-------------------------------------------------------------------- library(ekioplot) library(ggplot2) ## ----theme-basic-------------------------------------------------------------- ggplot(mtcars, aes(wt, mpg)) + geom_point(color = ekio_pal("blue")["700"], size = 2.5) + labs( title = "Fuel Efficiency vs. Weight", subtitle = "Motor Trend Car Road Tests (1974)", x = "Weight (1000 lbs)", y = "Miles per Gallon" ) + theme_ekio() ## ----theme-grid--------------------------------------------------------------- ggplot(mtcars, aes(wt, mpg)) + geom_point(color = ekio_pal("blue")["700"]) + theme_ekio(grid = "xy") ## ----list-palettes------------------------------------------------------------ str(list_ekio_palettes()) ## ----palette-access----------------------------------------------------------- ekio_pal("full") ekio_pal("cool3") ekio_pal("accent_blue", n = 5) ekio_pal("blue", n = 5) ## ----show-palette------------------------------------------------------------- ekio_pal("full") ## ----scale-discrete----------------------------------------------------------- ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) + geom_point(size = 3) + scale_color_ekio_d("full") + labs(color = "Cylinders") + theme_ekio(grid = "xy") ## ----scale-continuous--------------------------------------------------------- ggplot(mtcars, aes(wt, mpg, color = hp)) + geom_point(size = 3) + scale_color_ekio_c("blue") + labs(color = "Horsepower") + theme_ekio(grid = "xy") ## ----recipe-histogram--------------------------------------------------------- ekio_histogram(mtcars, mpg) ## ----recipe-barplot----------------------------------------------------------- cyl_counts <- as.data.frame(table(cyl = mtcars$cyl)) names(cyl_counts)[2] <- "n" ekio_barplot(cyl_counts, cyl, n) ## ----recipe-scatter----------------------------------------------------------- ekio_scatterplot(mtcars, wt, mpg, color = factor(cyl)) ## ----recipe-area-------------------------------------------------------------- economic_series <- subset( ggplot2::economics_long, variable %in% c("pce", "psavert", "uempmed") ) ekio_areaplot(economic_series, date, value01, fill = variable) ## ----recipe-static-color------------------------------------------------------ ekio_histogram(mtcars, mpg, fill = "coral") ## ----brand-scale-------------------------------------------------------------- ekio_pal("gray") ## ----brand-shades------------------------------------------------------------- ekio_pal("blue")["700"] ekio_pal("blue")[7] ## ----brand-interpolate-------------------------------------------------------- ekio_pal("blue", n = 3)