Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
plot.xts axis only shows two labels #246
The x-axis annotation is somewhat overly sparse on irregular data
I would expect the usual four to five ticks to be shown
Minimal, reproducible example
The image comes from running the example which requires the package. The same effect appears
## library(RcppUTS) ## example(EMAnext) ## ## or directly: suppressMessages(library(xts)) times <- ISOdatetime(2010, 1, 2, 8, 30, 0) + c(0, 1.0, 1.2, 2.3, 2.9, 5.0) values <- seq(0, 10, by=2) plot(xts(values, order.by=times), type="b", main="Series and last/next/linear EMAs") #lines(xts(EMAlast(times,values, 1), values, order.by=times), # type="b", col="lightblue") # lines(xts(EMAnext(times,values, 1), values, order.by=times), # type="b", col="darkblue") # lines(xts(EMAlinear(times,values, 1), values, order.by=times), # type="b", col="mediumblue") addLegend("topleft", legend.names=c("series", "EMAlast", "EMAnext", "EMAlinear"), lty=rep(1,4), lwd=rep(1,4), col=c("black", "lightblue", "darkblue", "mediumblue"))
will re-create the same plot shown on the repository README.md and here:
Current CRAN versions of everything.
I agree with @joshuaulrich that setting the default arguments to "auto" for the grid and axis ticks is a good solution. The default is "months" which is only reasonable for several months of data on a daily or lower frequency.
One possible problem: xts objects are often irregularly spaced, which means there could easily be no observations where you would want to place a tick mark based on the logic in