Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

scale_manual

tidyquant colors and fills for ggplot2.


Description

The tidyquant scales add colors that work nicely with theme_tq().

Usage

scale_color_tq(..., theme = "light")

scale_colour_tq(..., theme = "light")

scale_fill_tq(..., theme = "light")

Arguments

...

common discrete scale parameters: name, breaks, labels, na.value, limits and guide. See discrete_scale() for more details

theme

one of "light", "dark", or "green". This should match the theme_tq() that is used with it.

Details

scale_color_tq

For use when color is specified as an aes() in a ggplot.

scale_fill_tq

For use when fill is specified as an aes() in a ggplot.

See Also

Examples

# Load libraries
library(tidyquant)
library(dplyr)
library(ggplot2)

# Get stock prices
stocks <- c("AAPL", "FB", "NFLX") %>%
    tq_get(from = "2013-01-01",
           to   = "2017-01-01")

# Plot for stocks
g <- stocks %>%
    ggplot(aes(date, adjusted, color = symbol)) +
    geom_line() +
    labs(title = "Multi stock example",
         xlab = "Date",
         ylab = "Adjusted Close")

# Plot with tidyquant theme and colors
g +
    theme_tq() +
    scale_color_tq()

tidyquant

Tidy Quantitative Financial Analysis

v1.0.3
MIT + file LICENSE
Authors
Matt Dancho [aut, cre], Davis Vaughan [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.