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

Improvements to plotting functionality #3164

Open
3 tasks
brosaplanella opened this issue Jul 19, 2023 · 3 comments
Open
3 tasks

Improvements to plotting functionality #3164

brosaplanella opened this issue Jul 19, 2023 · 3 comments
Labels
difficulty: medium Will take a few days feature priority: low No existing plans to resolve

Comments

@brosaplanella
Copy link
Member

brosaplanella commented Jul 19, 2023

Description

Here are a list of possible improvements to PyBaMM's plotting capability (please suggest additional ones if you have any ideas):

  • Allow QuickPlot.plot to take a list of times #4271
  • Have a static_plot mode so variables that depend on space (1D) and time are plotted as heatmaps rather than dynamic curves.
  • When a plot has two lines, both constant, but of different value, they don't display as they sit in the edge of the plot (the current fix for constants only works if there is a single line).

Motivation

No response

Possible Implementation

No response

Additional context

Not sure if there are easy hacks or ways around this, but if so it was not clear in the docs.

@brosaplanella brosaplanella added feature difficulty: medium Will take a few days priority: low No existing plans to resolve labels Jul 19, 2023
@Saransh-cpp
Copy link
Member

Saransh-cpp commented Jul 20, 2023

I think a portion of create_gif does act as the proposed QuickPlot.plot. We can maybe refactor this method to make way for the new method -

def create_gif(self, number_of_images=80, duration=0.1, output_filename="plot.gif"):
"""
Generates x plots over a time span of max_t - min_t and compiles them to create
a GIF.
Parameters
----------
number_of_images : int (optional)
Number of images/plots to be compiled for a GIF.
duration : float (optional)
Duration of visibility of a single image/plot in the created GIF.
output_filename : str (optional)
Name of the generated GIF file.
"""
import imageio.v2 as imageio
import matplotlib.pyplot as plt
# time stamps at which the images/plots will be created
time_array = np.linspace(self.min_t, self.max_t, num=number_of_images)
images = []
# create images/plots
for val in time_array:
self.plot(val)
images.append("plot" + str(val) + ".png")
self.fig.savefig("plot" + str(val) + ".png", dpi=300)
plt.close()

@brosaplanella
Copy link
Member Author

My bad, I wasn't very clear. I meant multiple snapshots on the same plot.

@medha-14
Copy link
Contributor

I would also like to work on the second issue, which involves creating a static_plot function. Could you please provide a more detailed explanation of this issue to help me better understand the requirements?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: medium Will take a few days feature priority: low No existing plans to resolve
Projects
None yet
Development

No branches or pull requests

3 participants