Skip to content

Commit

Permalink
size -> linewidth
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Oct 2, 2023
1 parent c8b35f0 commit c46472a
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Imports:
recipes (>= 1.0.4),
rsample,
dplyr (>= 1.0.0),
ggplot2,
ggplot2 (>= 3.4.0),
forcats,
stringr,
plotly,
Expand Down
10 changes: 5 additions & 5 deletions R/plot-acf_diagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#' @param .facet_ncol Facets: Number of facet columns. Has no effect if using `grouped_df`.
#' @param .facet_scales Facets: Options include "fixed", "free", "free_y", "free_x"
#' @param .line_color Line color. Use keyword: "scale_color" to change the color by the facet.
#' @param .line_size Line size
#' @param .line_size Line size (linewidth)
#' @param .line_alpha Line opacity. Adjust the transparency of the line. Range: (0, 1)
#' @param .point_color Point color. Use keyword: "scale_color" to change the color by the facet.
#' @param .point_size Point size
Expand Down Expand Up @@ -215,11 +215,11 @@ plot_acf_diagnostics.data.frame <- function(.data, .date_var, .value, .ccf_vars
if (.line_color == "scale_color") {
g <- g +
ggplot2::geom_line(ggplot2::aes(color = name),
size = .line_size, alpha = .line_alpha) +
linewidth = .line_size, alpha = .line_alpha) +
scale_color_tq()
} else {
g <- g +
ggplot2::geom_line(color = .line_color, size = .line_size, alpha = .line_alpha)
ggplot2::geom_line(color = .line_color, linewidth = .line_size, alpha = .line_alpha)
}

# Add points
Expand Down Expand Up @@ -335,11 +335,11 @@ plot_acf_diagnostics.grouped_df <- function(.data, .date_var, .value, .ccf_vars
if (.line_color == "scale_color") {
g <- g +
ggplot2::geom_line(ggplot2::aes(color = .groups_consolidated),
size = .line_size, alpha = .line_alpha) +
linewidth = .line_size, alpha = .line_alpha) +
scale_color_tq()
} else {
g <- g +
ggplot2::geom_line(color = .line_color, size = .line_size, alpha = .line_alpha)
ggplot2::geom_line(color = .line_color, linewidth = .line_size, alpha = .line_alpha)
}

# Add points
Expand Down
8 changes: 4 additions & 4 deletions R/plot-anomaly_diagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ plot_anomaly_diagnostics.data.frame <- function(
# Add line
g <- g +
ggplot2::geom_line(
color = .line_color,
size = .line_size,
linetype = .line_type,
alpha = .line_alpha
color = .line_color,
linewidth = .line_size,
linetype = .line_type,
alpha = .line_alpha
)

# Add Outliers
Expand Down
14 changes: 7 additions & 7 deletions R/plot-time_series.R
Original file line number Diff line number Diff line change
Expand Up @@ -361,19 +361,19 @@ plot_time_series.data.frame <- function(
if (rlang::quo_is_null(color_var_expr)) {
g <- g +
ggplot2::geom_line(
color = .line_color,
size = .line_size,
linetype = .line_type,
alpha = .line_alpha
color = .line_color,
linewidth = .line_size,
linetype = .line_type,
alpha = .line_alpha
)

} else {
g <- g +
ggplot2::geom_line(
ggplot2::aes(color = .color_mod, group = .color_mod),
size = .line_size,
linetype = .line_type,
alpha = .line_alpha
linewidth = .line_size,
linetype = .line_type,
alpha = .line_alpha
) +
scale_color_tq()
}
Expand Down
24 changes: 12 additions & 12 deletions R/tidyquant-theme-compat.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ theme_tq <- function(base_size = 11, base_family = "") {
ggplot2::theme(

# Base Inherited Elements
line = ggplot2::element_line(colour = blue, size = 0.5, linetype = 1,
line = ggplot2::element_line(colour = blue, linewidth = 0.5, linetype = 1,
lineend = "butt"),
rect = ggplot2::element_rect(fill = white, colour = blue,
size = 0.5, linetype = 1),
linewidth = 0.5, linetype = 1),
text = ggplot2::element_text(family = base_family, face = "plain",
colour = blue, size = base_size,
lineheight = 0.9, hjust = 0.5, vjust = 0.5, angle = 0,
Expand All @@ -27,14 +27,14 @@ theme_tq <- function(base_size = 11, base_family = "") {
# Axes
axis.line = ggplot2::element_blank(),
axis.text = ggplot2::element_text(size = ggplot2::rel(0.8)),
axis.ticks = ggplot2::element_line(color = grey, size = ggplot2::rel(1/3)),
axis.ticks = ggplot2::element_line(color = grey, linewidth = ggplot2::rel(1/3)),
axis.title = ggplot2::element_text(size = ggplot2::rel(1.0)),

# Panel
panel.background = ggplot2::element_rect(fill = white, color = NA),
panel.border = ggplot2::element_rect(fill = NA, size = ggplot2::rel(1/2), color = blue),
panel.grid.major = ggplot2::element_line(color = grey, size = ggplot2::rel(1/3)),
panel.grid.minor = ggplot2::element_line(color = grey, size = ggplot2::rel(1/3)),
panel.border = ggplot2::element_rect(fill = NA, linewidth = ggplot2::rel(1/2), color = blue),
panel.grid.major = ggplot2::element_line(color = grey, linewidth = ggplot2::rel(1/3)),
panel.grid.minor = ggplot2::element_line(color = grey, linewidth = ggplot2::rel(1/3)),
panel.grid.minor.x = ggplot2::element_blank(),
panel.spacing = ggplot2::unit(.75, "cm"),

Expand Down Expand Up @@ -70,12 +70,12 @@ theme_tq_dark <- function(base_size = 11, base_family = "") {
ggplot2::theme(

# Axes
axis.ticks = ggplot2::element_line(color = blue, size = ggplot2::rel(1/3)),
axis.ticks = ggplot2::element_line(color = blue, linewidth = ggplot2::rel(1/3)),

# Panel
panel.background = ggplot2::element_rect(fill = grey, color = NA),
panel.grid.major = ggplot2::element_line(color = white, size = ggplot2::rel(1/3)),
panel.grid.minor = ggplot2::element_line(color = white, size = ggplot2::rel(1/3)),
panel.grid.major = ggplot2::element_line(color = white, linewidth = ggplot2::rel(1/3)),
panel.grid.minor = ggplot2::element_line(color = white, linewidth = ggplot2::rel(1/3)),

# Complete theme
complete = TRUE
Expand All @@ -95,12 +95,12 @@ theme_tq_green <- function(base_size = 11, base_family = "") {
ggplot2::theme(

# Axes
axis.ticks = ggplot2::element_line(color = blue, size = ggplot2::rel(1/3)),
axis.ticks = ggplot2::element_line(color = blue, linewidth = ggplot2::rel(1/3)),

# Panel
panel.background = ggplot2::element_rect(fill = green, color = NA),
panel.grid.major = ggplot2::element_line(color = white, size = ggplot2::rel(1/3)),
panel.grid.minor = ggplot2::element_line(color = white, size = ggplot2::rel(1/3)),
panel.grid.major = ggplot2::element_line(color = white, linewidth = ggplot2::rel(1/3)),
panel.grid.minor = ggplot2::element_line(color = white, linewidth = ggplot2::rel(1/3)),

# Complete theme
complete = TRUE
Expand Down
2 changes: 1 addition & 1 deletion man/plot_acf_diagnostics.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c46472a

Please sign in to comment.