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

plot pybamm arrays #992

Closed
rtimms opened this issue May 13, 2020 · 3 comments · Fixed by #1008
Closed

plot pybamm arrays #992

rtimms opened this issue May 13, 2020 · 3 comments · Fixed by #1008
Assignees
Labels

Comments

@rtimms
Copy link
Contributor

rtimms commented May 13, 2020

It would be nice to automate the plotting of pybamm.Array objects for doing things like the example below. I think just 1D is fine for now. More complicated will usually be of solution entries, so handled via Quickplot, but it would be nice to easily plot parameters that are functions. I guess 2D is useful since this depends on T and sto. Thoughts?

Edit: I know calling .entries isn't a huge deal, but think this would be easy to implement and avoid needing to import matplotlib

import pybamm
import numpy as np
import matplotlib.pyplot as plt

param = pybamm.ParameterValues(chemistry=pybamm.parameter_sets.Ecker2015)
D_fun = param["Negative electrode diffusivity [m2.s-1]"]
x = pybamm.Array(np.linspace(0,1,100))
D = D_fun(x, 300)
plt.plot(x.entries,D.entries) 
@rtimms rtimms added the feature label May 13, 2020
@valentinsulzer
Copy link
Member

do you mean something to replace the last line with pybamm.plot(x,D)?

@rtimms
Copy link
Contributor Author

rtimms commented May 13, 2020

yeah, sorry I wasn't very clear

@valentinsulzer
Copy link
Member

Yeah that sounds like a good feature. And you could do pybamm.plot([x,T], D(x,T)) for 2D.

@rtimms rtimms self-assigned this May 20, 2020
rtimms added a commit that referenced this issue May 20, 2020
rtimms added a commit that referenced this issue May 20, 2020
@rtimms rtimms mentioned this issue May 20, 2020
8 tasks
rtimms added a commit that referenced this issue May 20, 2020
rtimms added a commit that referenced this issue May 26, 2020
rtimms added a commit that referenced this issue May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants