-
Notifications
You must be signed in to change notification settings - Fork 180
/
Copy paththeme_tq.Rd
49 lines (43 loc) · 1.22 KB
/
theme_tq.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ggplot-theme_tq.R
\name{theme_tq}
\alias{theme_tq}
\alias{theme_tq_dark}
\alias{theme_tq_green}
\title{tidyquant themes for ggplot2.}
\usage{
theme_tq(base_size = 11, base_family = "")
theme_tq_dark(base_size = 11, base_family = "")
theme_tq_green(base_size = 11, base_family = "")
}
\arguments{
\item{base_size}{base font size, given in pts.}
\item{base_family}{base font family}
}
\description{
The \code{theme_tq()} function creates a custom theme using tidyquant colors.
}
\examples{
# Load libraries
library(dplyr)
library(ggplot2)
# Get stock prices
AAPL <- tq_get("AAPL", from = "2013-01-01", to = "2016-12-31")
# Plot using ggplot with theme_tq
AAPL \%>\% ggplot(aes(x = date, y = close)) +
geom_line() +
geom_bbands(aes(high = high, low = low, close = close),
ma_fun = EMA,
wilder = TRUE,
ratio = NULL,
n = 50) +
coord_x_date(xlim = c("2016-01-01", "2016-12-31"),
ylim = c(20, 35)) +
labs(title = "Apple BBands",
x = "Date",
y = "Price") +
theme_tq()
}
\seealso{
\code{\link[=scale_manual]{scale_manual()}}
}