xts
xts copied to clipboard
Points added to new panel when par(mfrow()) is set
#The code below worked, prior to me upgrading from xts version 0.9-7 to 0.10-0, to produce a single panel with two plots, points overlaid onto each. Now each time points() is called it takes up the next row on the panel instead.
Example 1
par(mfrow=c(2,1))
dates = as.Date((Sys.Date()-49):Sys.Date())
v1 = xts(rnorm(1:50), dates)
v2 = ifelse(v1>mean(v1),v1,NA)
plot(v1, type = 'l')
points(v2, pch = 16, cex = 1)
v3 = xts(rnorm(1:50), dates)
v4 = ifelse(v3>mean(v3),v3,NA)
plot(v3, type = 'l')
points(v4, pch = 16, cex = 1)
Overlaying the points on a single plot still works fine.
Example 2
dev.off()
dates = as.Date((Sys.Date()-49):Sys.Date())
v1 = xts(rnorm(1:50), dates)
v2 = ifelse(v1>mean(v1),v1,NA)
plot(v1, type = 'l')
points(v2, pch = 16, cex = 1)
When not using xts, the code still works to produce the desired result. See below:
Example 3: Desired Result
dev.off()
par(mfrow=c(2,1))
v1 = rnorm(1:50)
v2 = ifelse(v1>mean(v1),v1,NA)
plot(v1, type = 'l')
points(v2, pch = 16, cex = 1)
v3 = rnorm(1:50)
v4 = ifelse(v3>mean(v3),v3,NA)
plot(v3, type = 'l')
points(v4, pch = 16, cex = 1)
It is my preference to build plots in layers. If I'm not able to do that anymore, how can I still produce my desired result?
Not sure what you mean by "yesterday's rollout". I'm assuming you mean you upgraded from xts version 0.9-7 to 0.10-0. This issue was supposedly addressed in #84. We might have a regression bug. We'll investigate.
Apologies, I edited my post to reflect the correct information.
It looks like the issue is with par(mfrow=c(2,1))
. The code works as expected with the default mfrow
values. The issue could be in xts:::current_panel()
and/or xts:::current_actions()
.
Hello I just would like to know if this issue has been solved, and if so :
- where I could get the corrected source code for plot.xts, lines (.xts ?) and points (.xts ?) ?
- when in your roadmap you could post your new package version onto the CRAN repository ?
xts package is very useful for me, thanks a lot ! Nota : this new version (10.0), compared to previous one (0.99...) might be sometimes a little tricky when trying to reproduce "graphs that worked before - and don't work anymore", but I'm sure it's full of good ideas.
Another question : Are "additive panels" sizes (for instance height) customisable ?
Thanks again Best regards, E.