Skip to content

Commit

Permalink
Capture ylim from '...'
Browse files Browse the repository at this point in the history
User-provided values for 'ylim' were not being captured because we
are no longer copying arguments to 'lenv'. This is a problem because
the 'plot_object$add_frame()' call needs a value for 'ylim'.

Fixes #220.
  • Loading branch information
joshuaulrich committed Dec 18, 2017
1 parent 3c1cd48 commit 14304ac
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -703,12 +703,12 @@ addSeries <- function(x, main="", on=NA, type="l", col=NULL, lty=1, lwd=1, pch=0
no.update <- FALSE
lenv$xdata <- merge(x,xdata,retside=c(TRUE,FALSE))
if(hasArg("ylim")) {
ylim <- lenv$ylim # lenv$ylim assigned above
ylim <- eval.parent(substitute(alist(...))$ylim)
} else {
ylim <- range(lenv$xdata[xsubset], na.rm=TRUE)
if(all(ylim == 0)) ylim <- c(-1, 1)
lenv$ylim <- ylim
}
lenv$ylim <- ylim

if(is.na(on[1])){
# add the frame for drawdowns info
Expand Down Expand Up @@ -1066,12 +1066,12 @@ addPolygon <- function(x, y=NULL, main="", on=NA, col=NULL, ...){
no.update <- FALSE
lenv$xdata <- merge(x,xdata,retside=c(TRUE,FALSE))
if(hasArg("ylim")) {
ylim <- lenv$ylim # lenv$ylim assigned above
ylim <- eval.parent(substitute(alist(...))$ylim)
} else {
ylim <- range(lenv$xdata[xsubset], na.rm=TRUE)
if(all(ylim == 0)) ylim <- c(-1, 1)
lenv$ylim <- ylim
}
lenv$ylim <- ylim

if(is.na(on[1])){
plot_object$add_frame(ylim=c(0,1),asp=0.25)
Expand Down

0 comments on commit 14304ac

Please sign in to comment.