Closed valentinsulzer closed 4 years ago
My thoughts are:
Some additional ideas that are non essential but might be nice:
Another thought though this really is just extra. It might be nice to have helper functions in simulation:
My thoughts:
QuickPlot
, as you can just call plot
to get a static plot at a fixed time. happy for dynamic_plot
to be renamed slider_plot
. Maybe there could be some default collections for plots people use a lot, but this doesn't necessarily need to be done in this issue and may be best for users to implement themselveslinestyles[j]
should be linestyles[i]
. adding a figsize would be niceplot
to get a single figure with profiles of the variables at different timeAll sound like good points. re: linestyles, the current functionality is that you can plot several variables on the same plot and they will be differentiated by the linestyles, which is why the different solutions are only differentiated by colour. For example
pybamm.QuickPlot(
solution,
output_variables=[
"Negative particle surface concentration",
"Positive particle surface concentration",
["Electrolyte current density", "Electrode current density"],
"Terminal voltage [V]",
],
)
gives
ah nice! I didn't know you could nest lists in that way to use in QuickPlot
When we call ipywidgets within simulation for slider plots in jupyter notebook, I think we should also pass the argument continuous_update=False
as this seems to give more responsive behaviour :)
Are you thinking to pass this in from the notebook or detect that it is being run from a notebook?
Was thinking to just change line 536 of simulation to:
widgets.interact(
plot.plot,
t=widgets.FloatSlider(min=0, max=plot.max_t, step=0.05, value=0),
continuous_update=False
)
Regarding linestyles, that is really neat and I didn't know you could do that either. I still think it would be nice to do models by linestyle though (if multiple variables are not plotted on the same figure) since I would use this more frequently.
can we just move isnotebook
to QuickPlot
so we can use it directly in notebooks without having to do the slider widget manually?
One additional thing that would be nice, is if QuickPlot can accept solution objects and simulation objects. If a simulation object is passed, it just does simulation.solution automatically. I am finding myself writing [sim1.solution, sim2.solution, etc] or having to do [sim.solution for sim in [sim1, sim2, sim3]] quite a bit, which is just messy
QuickPlot
could do with a few updates. Feel free to add more to this list:set_output_variables
to make it more obvious what is being doneSliderPlot
?