GLEON / glmtools

Tools for interacting with the General Lake Model (GLM) in R
Other
22 stars 31 forks source link

Plot_var - Scaling #253

Open dzrobert opened 5 years ago

dzrobert commented 5 years ago

The old plot var allowed the user to define the limits on the plot. Is there any way to do that anymore?

hdugan commented 5 years ago

Dale, to clarify, it looks like the old function had ability to set the x-axis dates, but not the y. Is that functionality you're looking for?

To the larger audience, right now the function is set up so you can use ggsave right in function. However, I think I could make the plotting function more versatile (like setting axes for instance, basically adding more ggplot functionality) if I remove the save function. Instead, the plotting function (plot_var) would produce a plot on-screen, and then you could save it.

Current Code:

plot_var(..., fig_path = 'savethis.png', height = 6, width = 6, units ='in')

New Code layout:

p1 = plot_var(...)
ggsave(p1, 'savethis.png', height = 6, width = 6, units ='in')
jordansread commented 5 years ago

I like the pattern where if filepath is NULL, the function returns the plot object (p1 here), vs if it is a filepath, that is used to save the plot.

hdugan commented 5 years ago

okie doke. can keep it that way

jordansread commented 5 years ago

does the current code do that? return something different depending on the fig_path variable?

dzrobert commented 5 years ago

I was referring to the scale used in the plots. Like TP going from 0 to 300 or 0 to 1000, Having the code pick the scale is nice, but often there is one very high point that results in one very small red spot and everything else white.

hdugan commented 5 years ago

Dale, ok, so with the z-variable. Got it. Will try and implement that. You could create a custom palette, where it emphasizes the lower values, but I understand that might be time consuming.

Jordan, the fig_path variable works the way it always did. I was just thinking the saving feature could be separate from the function, as ggplot makes that very easy. But I'll keep it as is.

jordansread commented 5 years ago

ok, good to know. I've been behind on poking around on this branch. Will try to soon.