question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plot parameter functions

See original GitHub issue

Some 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:closed
  • Created 2 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
tinosulzercommented, Apr 26, 2021

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).

1reaction
tinosulzercommented, Apr 28, 2021

I see the issue now. What about editing the .evaluate() function so it can return an array?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found