Skip to content

Commit

Permalink
Fix handling of col, lty, lwd in multi.panel plots
Browse files Browse the repository at this point in the history
Commit 3086e14 introduced a
regression. The prior behavior allowed every data point in the series
to have a different color, line type, and line width.

Fixes #426.
  • Loading branch information
ethanbsmith authored Nov 3, 2024
1 parent a1aa0e3 commit 4a525e9
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,20 @@ plot.xts <- function(x,
legend.loc=NULL,
extend.xaxis=FALSE){

# check for colorset or col argument
if(hasArg("colorset")) {
col <- eval.parent(plot.call$colorset)
}
# ensure pars have ncol(x) elements
col <- rep(col, length.out = NCOL(x))
lty <- rep(lty, length.out = NCOL(x))
lwd <- rep(lwd, length.out = NCOL(x))
if(is.numeric(multi.panel) || isTRUE(multi.panel)) {
# Only need to check pars in multipanel scenarios. The single panel
# scenarios supports colors for each data point in the series.

# check for colorset or col argument
if(hasArg("colorset")) {
col <- eval.parent(plot.call$colorset)
}
# ensure pars have ncol(x) elements
col <- rep(col, length.out = NCOL(x))
lty <- rep(lty, length.out = NCOL(x))
lwd <- rep(lwd, length.out = NCOL(x))
}

# Small multiples with multiple pages behavior occurs when multi.panel is
# an integer. (i.e. multi.panel=2 means to iterate over the data in a step
# size of 2 and plot 2 panels on each page
Expand Down

0 comments on commit 4a525e9

Please sign in to comment.