Skip to content

Commit

Permalink
moved col length checks to cover multi.panel = T as well as being num…
Browse files Browse the repository at this point in the history
…eric
  • Loading branch information
ethanbsmith committed Jul 28, 2024
1 parent 5429845 commit 6590b39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,14 @@ plot.xts <- function(x,
grid2="#F5F5F5",
legend.loc=NULL,
extend.xaxis=FALSE){


if (as.numeric(multi.panel) > 0){
# allow color and line attributes for each panel in a multi.panel plot
if(length(lty) < ncol(x)) lty <- rep(lty, length.out = ncol(x))
if(length(lwd) < ncol(x)) lwd <- rep(lwd, length.out = ncol(x))
if(length(col) < ncol(x)) col <- rep(col, 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 All @@ -256,12 +263,6 @@ plot.xts <- function(x,
idx <- seq.int(1L, NCOL(x), 1L)
chunks <- split(idx, ceiling(seq_along(idx)/multi.panel))

# allow color and line attributes for each panel in a multi.panel plot
if(length(lty) < ncol(x)) lty <- rep(lty, length.out = ncol(x))
if(length(lwd) < ncol(x)) lwd <- rep(lwd, length.out = ncol(x))
if(length(col) < ncol(x)) col <- rep(col, length.out = ncol(x))


if(!is.null(panels) && nchar(panels) > 0){
# we will plot the panels, but not plot the data by column
multi.panel <- FALSE
Expand Down
Binary file added src/xts.dll
Binary file not shown.

0 comments on commit 6590b39

Please sign in to comment.