Plot parameter functions
See original GitHub issueSome parameters are provided as functions (e.g. diffusivity as a function of concentration and temperature). Currently, to plot them you have to do something like this
import pybamm
params = pybamm.ParameterValues(chemistry=pybamm.parameter_sets.Chen2020)
i0 = params["Negative electrode exchange-current density [A.m-2]"]
x = pybamm.linspace(3000,6000,100)
i0_eval = i0(1000,x,300)
i0_processed = params.process_symbol(i0_eval)
pybamm.plot(x, i0_processed)
We have to process the function “Negative electrode exchange-current density [A.m-2]” since its definition contains a pybamm.Parameter
. It would be neat to be able to do something like params.plot("Negative electrode exchange-current density [A.m-2]", (1000, x, 300))
instead so you can quickly plot the functional dependence of parameters. We can use pybamm.plot
and pybamm.plot2D
to plot the resulting arrays.
Maybe you could pass a list or dict of parameter names and values so you can plot multiple parameters on the same plot.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Plot Parametric Functions
The Wolfram Language can plot parametric functions in both two and three dimensions. Use a parametric plot when you can express the and...
Read more >The plot() function -- plotting points and lines
Point and line plots can be produced using plot() function, which takes x and y points either as vectors or single number along...
Read more >Parametric equation plotter
Use functions sin(), cos(), tan(), exp(), ln(), abs(). Adjust the range of values for which t is plotted. For example to plot type...
Read more >Parametric Equations, Vector Functions, and Fine-Tuning ...
To plot vector functions or parametric equations, you follow the same idea as in plotting 2D functions, setting up your domain for t....
Read more >Wolfram|Alpha Examples: Plotting & Graphics
Plotting & Graphics · Functions · 3D Plots · Equations · Inequalities · Polar Plots · Parametric Plots · RELATED EXAMPLES.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Just a comment - when we provide custom plotting functions we need to be careful not to do so at the expense of matplotlib flexibility (specifying args and kwargs in the plot, adding xlabel and ylabel and legend, etc).
I see the issue now. What about editing the
.evaluate()
function so it can return an array?