Qepanna / goFlux

goFlux: A user-friendly way to calculate GHG fluxes yourself, regardless of user experience
https://qepanna.quarto.pub/goflux/
GNU General Public License v2.0
18 stars 5 forks source link

Suggestion: keep the plots from click.peak #2

Closed Schuch666 closed 5 months ago

Schuch666 commented 6 months ago

Can an option to save the plot from the pop-up window or disable the auto-close of the click.peak function? I think this plot can be interesting to keep

Qepanna commented 5 months ago

Can an option to save the plot from the pop-up window or disable the auto-close of the click.peak function? I think this plot can be interesting to keep

I see two options for saving these plots: Either create a new function that will make plots from the output of click.peak, OR if save.plot = TRUE in click.peak, the output of click.peak is now a list of two objects: one data frame and one list of plots. The first option requires a bit more effort, but, from a “user-friendly” point of view, it can help users avoid making mistakes.

On the other hand, these plots are not that useful to keep, since the function flux.plot will essentially return the same plot, but with additional content from the output of goFlux and best.flux.

What do you think is best?

Schuch666 commented 5 months ago

I think a function duplicating the same code is not the best option, the second options looks better (and do not require to change the output format).

And how about the user give only a file.name in case he/she want to save the plot?

Qepanna commented 5 months ago

@Schuch666 While trying my best to add an option to save plots in the functions click.peak and click.peak.loop, I realized that these two functions were quite unelegant. I then decided to create a new function click.peak2 to replace those two functions and I deprecated them.

The new function click.peak2 can now loop through a list of data frame like click.peak.loop, without the use of lapply, and there is an option to save plots.

Schuch666 commented 5 months ago

That’s sound great!