Skip to content

plot.xts axis only shows two labels #246

Closed
@eddelbuettel

Description

Description

The x-axis annotation is somewhat overly sparse on irregular data

Expected behavior

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
just with the code not commented out here

## 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:

image

Session Info

Current CRAN versions of everything.

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions