USGS-R / lakeReport

Scripts and report generator
Other
0 stars 4 forks source link

qwtimeseries plots - move legends #70

Closed sbmarsh-USGS closed 7 years ago

sbmarsh-USGS commented 7 years ago

The legends block some of the data points on some plots. Can we move them outside the plots? Put them under the lower title or elsewhere? image

lindsayplatt commented 7 years ago

@sbmarsh-USGS you should try this one out first. Add an argument to the legend call in the makeTimeseriesPlot function . The argument to move the legend is location and possible values are "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right", "center", "below", "toright", "toleft", and "below". If it goes outside of the plotting region, you might need to play with plot margins.

This is where the legend call happens: https://github.com/USGS-R/lakeReport/blob/master/R/functions-qwtimeseries.R#L79-L82

sbmarsh-USGS commented 7 years ago

I've tried both of the following with no luck. Nothing moves, it just doesn't work.

legend(pch = c(pch_usgs,pch_usgs,pch_observer,pch_observer), col = rep(c(col_uncensored, col_censored),2), location(center), legend = c("USGS - Uncensored", "USGS - Censored", "Observer - Uncensored", "Observer - Censored"))

legend(pch = c(pch_usgs,pch_usgs,pch_observer,pch_observer), col = rep(c(col_uncensored, col_censored),2), location = center, legend = c("USGS - Uncensored", "USGS - Censored", "Observer - Uncensored", "Observer - Censored"))

lindsayplatt commented 7 years ago

:point_up: if that's the exact code you were trying, you should be using location = "center" with the word center in quotes. So close!

lindsayplatt commented 7 years ago

Fixed in #77 and #80