USGS-R / gsplot

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

Layout bug & more! #431

Closed ldecicco-USGS closed 7 years ago

ldecicco-USGS commented 7 years ago

So now, what works (that didn't in last 2 PRs):

g1 <- gsplot(xpd=FALSE) %>% 
  lines(1:9, seq(1,3, by=0.25), 
        legend.name="second line") %>% 
  axis(side=2, at=1:10)
g1
layout(matrix(1:2, 1, 2))
g1
g1

image

#Works:
gs1 <- gsplot() %>% 
  points(1:3, c(1,10,100)) %>% 
  points(3:5, c(10,100,1000), col="blue", side=4, log='y') %>% 
  axis(side=4) 
gs1

image

#Works:
gs2 <- gsplot() %>% 
  points(c(1,10,100), 1:3, side=1) %>% 
  points(c(10,100,1000), 3:5, col="blue", side=3, log='x') %>% 
  axis(side=3) 
gs2

image

UPDATE!!!

#Works:
layout(matrix(1:2, 1, 2))
gs1
gs2

image

and also still doesn't work:

gs <- gsplot() %>% 
  points(c(1,10,100), 1:3, side=1) %>% 
  points(c(10,100,1000), 3:5, col="blue", side=3) %>% 
  axis(side=3) %>% 
  view(side=1, log='x')
gs

image

only side 1 should be logged, not 3

I think those are 2 current bugs, but this PR gets us a bunch fixed as-is.

I'll try to get these bugs listed as issues.

ldecicco-USGS commented 7 years ago

Oh, and I added a function clear_par that will reset to the par that was on the users computer when they loaded the package. I think it's useful...not sure if we need something fancier, or if that's it.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.3%) to 81.001% when pulling f44de9669ff318051b0c2878c4410de40e2a401b on ldecicco-USGS:layout_bug into b6678938c35a8f1a0655a521f0b6edc7899b043e on USGS-R:master.

lindsayplatt commented 7 years ago

@ldecicco-USGS those log separate sides issues were fixed in #424. This seems to break that behavior?

Based on #424:

gs <- gsplot() %>% 
  points(c(1,10,100), 1:3, side=1) %>% 
  points(c(10,100,1000), 3:5, col="blue", side=3) %>% 
  axis(side=3) %>% 
  view(side=1, log='x')
gs

returns side 1 logged, but not side 3 as I would expect image

ldecicco-USGS commented 7 years ago

Yeah, but that's the PR that broke all the layout graphs. This pr fixes much of layout and 3/4 log axis graphs.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.5%) to 80.859% when pulling 01e06a6f7eb9e6bef7e376abbef8d3634b88aec1 on ldecicco-USGS:layout_bug into b6678938c35a8f1a0655a521f0b6edc7899b043e on USGS-R:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.5%) to 80.859% when pulling 01e06a6f7eb9e6bef7e376abbef8d3634b88aec1 on ldecicco-USGS:layout_bug into b6678938c35a8f1a0655a521f0b6edc7899b043e on USGS-R:master.

ldecicco-USGS commented 7 years ago

Currently struggling with:

view.usr <- par('usr')

unnamed-chunk-22-1.png shows the issues.

jiwalker-usgs commented 7 years ago

The second plot in the diff seems to have issues with it (legend overlaps y axis). Otherwise this looks pretty good.

ldecicco-USGS commented 7 years ago

yeah, I think the legend placement is because of that par('usr')...still fiddling with it.

ldecicco-USGS commented 7 years ago

A-OK! I think a bunch of stuff is fixed by doing a final set_frame call towards the end of print to make the default frame at the end view.1.2 (if defined), or the first one that the user defined (if 1.2 isn't defined).

I think it's good-to-go.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.2%) to 81.119% when pulling 83310288755ec5a3b199afba187f4ec3ca23fa3f on ldecicco-USGS:layout_bug into b6678938c35a8f1a0655a521f0b6edc7899b043e on USGS-R:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.2%) to 81.119% when pulling 83310288755ec5a3b199afba187f4ec3ca23fa3f on ldecicco-USGS:layout_bug into b6678938c35a8f1a0655a521f0b6edc7899b043e on USGS-R:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.2%) to 81.119% when pulling 83310288755ec5a3b199afba187f4ec3ca23fa3f on ldecicco-USGS:layout_bug into b6678938c35a8f1a0655a521f0b6edc7899b043e on USGS-R:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.2%) to 81.119% when pulling 83310288755ec5a3b199afba187f4ec3ca23fa3f on ldecicco-USGS:layout_bug into b6678938c35a8f1a0655a521f0b6edc7899b043e on USGS-R:master.