USGS-R / gsplot

plotting foundation for timeseries reporting
Other
6 stars 14 forks source link

indexing allowed for points and lines #420

Closed lindsayplatt closed 7 years ago

lindsayplatt commented 7 years ago

Does not label x axis as "Index" and y with range. Works for logged axes and keeps user-specified axis labels. Also works with dates and other classes. It also works for lines.

See #245

Originally, I had implemented this using xy.coords since that is what points.default and lines.default call, but if coerces data into numeric.

gs <- gsplot()  %>%
    points(1:10, xlab="my points", log="y")
gs

image

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.1%) to 82.241% when pulling a1a239c2ae06fe2169818ec893bfdd67f717d367 on lindsaycarr:indexLost into e83939801c276a1aadcc236ddb7a662fb05ad2aa on USGS-R:master.

jordansread commented 7 years ago

I agree w/ what @jiwalker-usgs said. this looks fine to me too, but we should (as in the past) just be able to pass the args on to points w/ y=NULL and have that function handle it appropriately.

lindsayplatt commented 7 years ago

@jread-usgs have points.gsplot handle it appropriately or graphics::points? The issue seems to be that we never pass it to points.default which calls plot.xy and handles this issue of y=NULL.

jordansread commented 7 years ago

I meant graphics::points, but I guess maybe this never worked correctly then?

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.2%) to 82.329% when pulling d7e1ab025f4efd87af9737fe24470b1e52bea9a8 on lindsaycarr:indexLost into e83939801c276a1aadcc236ddb7a662fb05ad2aa on USGS-R:master.

lindsayplatt commented 7 years ago

I guess I'm struggling with the override function and how UseMethod works. It should get to points.default somehow, which handles the xy indexing https://svn.r-project.org/R/trunk/src/library/graphics/R/points.R