Skip to content

Commit

Permalink
check for ylim of 0s
Browse files Browse the repository at this point in the history
- calling lines, points, or more generally addSeries with an xts
  object of all 0s results in an invalid ylim of (0,0)
- this adds a check for a ylim of (0,0) and if true sets the ylim
  to c(-1,1)
- see #164
  • Loading branch information
rossb34 committed Jan 25, 2017
1 parent 61bc4fe commit 8ab0ad3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ addSeries <- function(x, main="", on=NA, type="l", col=NULL, lty=1, lwd=1, pch=0
ylim <- lenv$ylim # lenv$ylim assigned via mapply above
} else {
ylim <- range(lenv$xdata[xsubset], na.rm=TRUE)
if(all(ylim == 0)) ylim <- c(-1, 1)
lenv$ylim <- ylim
}

Expand Down

0 comments on commit 8ab0ad3

Please sign in to comment.