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

Custom Plot API #177

Open
wants to merge 2 commits into
base: webview
Choose a base branch
from

Conversation

hoogerheide
Copy link
Contributor

This is a dummy custom plot API allowing responsive plots of quantities derived from the model parameters.

Basically the plot definition function is stored in a new attribute of problem, problem.custom_plot, and must output a Plotly figure that is rendered directly and responsively in the Refl1D GUI.

Future improvements could involve allowing multiple plots (say, as a dictionary, with keys corresponding to the title of each custom plot, and they can be selected using pills or tabs).

This PR is intended mainly as a conversation starter around this. A model file with data that show this in operation is attached.

crau_popc.zip

@bmaranville
Copy link
Member

This is an interesting proposal, and adding custom plots to the interface would definitely be useful. I can see how attaching them directly to a problem would make sense too, since the type of plot may be very specific or even unique.

I'm not quite sure how to make this portable, i.e. how do you share the custom plot routines unless you require that the model always be loaded from your python script? You can pickle the functions, but that is somewhat fragile, and then you lose the capability of representing your problem in terms of a plain dictionary (the basis for building a model builder).

I'm guessing that the plots you are building are not arbitrary, and are in fact quite specific and relevant to the models built with molgroups, in which case we should definitely support Experiment or FitProblem subclasses providing their own plotting routines, so that all users can make use of these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants