Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to combine plots for different simulations #105

Closed
gustavdelius opened this issue Sep 17, 2019 · 7 comments
Closed

How to combine plots for different simulations #105

gustavdelius opened this issue Sep 17, 2019 · 7 comments
Labels
discussion An idea that needs discussion before becoming a proposal enhancement New feature requests or suggestions for enhancement of existing features extension This feature should be implemented as a mizer extension plots Issue relates to plotting functionality

Comments

@gustavdelius
Copy link
Member

Often one will want to combine the result of two different simulations on the same plot, for example to compare the consequences of different fishing regimes. This is not easy to achieve with mizer's existing plot functions. I have played with two different approaches to solving this problem:

  1. Allowing an optional second MizerSim object to be passed to a plotting function, see plotYield().
  2. Creating functions that return the dataframe needed to produce the plot, rather than the plot itself, see getBiomassFrame() and getSSBFrame(), and then providing a function displayFrames() that takes two of these frames and plots them.

Neither of these are perfect, so please make your own suggestions.

We should probably settle on one approach and then implement it consistently for all plotting functions where it is appropriate.

@gustavdelius gustavdelius added enhancement New feature requests or suggestions for enhancement of existing features discussion An idea that needs discussion before becoming a proposal plots Issue relates to plotting functionality labels Sep 17, 2019
@Kenhasteandersen
Copy link
Contributor

Kenhasteandersen commented Sep 19, 2019 via email

@gustavdelius
Copy link
Member Author

@Kenhasteandersen , which plotting functions did you implement option 1 for? Do you want to share your code? Did you do it more elegantly than how it is done for plotYield(), which contains a lot of code duplication?

@Kenhasteandersen
Copy link
Contributor

Kenhasteandersen commented Sep 19, 2019 via email

@gustavdelius
Copy link
Member Author

For now I have moved the displayFrame() function for displaying several frames in the same plot to the mizerExperimental extension package (https://sizespectrum.org/mizerExperimental/), where we can experiment until we find the best way to provide this functionality.

@gustavdelius gustavdelius added the extension This feature should be implemented as a mizer extension label Mar 6, 2020
@gustavdelius
Copy link
Member Author

It may also be worthwhile to say that we now have a section in the user guide that discusses how to make plots comparing results from two different simulations: https://sizespectrum.org/mizer/dev/articles/plotting.html#comparing-simulations

@gustavdelius
Copy link
Member Author

Another development on this front is that @baldrech is going to give an extra argument to the plotting functions to allow them to return a data frame suitable for use with ggplot2 instead of the plot itself. These could then be used to create plots combining several such data frames.

@gustavdelius
Copy link
Member Author

@baldrech 's return_data argument to all plotting functions that makes them return a data frame together with the new plotDataFrame() function now makes displayFrames() and the get...Frame() functions obsolete and they have been removed from MizerExperimental.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion An idea that needs discussion before becoming a proposal enhancement New feature requests or suggestions for enhancement of existing features extension This feature should be implemented as a mizer extension plots Issue relates to plotting functionality
Projects
None yet
Development

No branches or pull requests

2 participants