Previous topic

Plot

Next topic

Utility functions

This Page

Plot 2D

pybamm.plot2D(x, y, z, xlabel=None, ylabel=None, title=None, testing=False, **kwargs)[source]

Generate a simple 2D plot. Calls matplotlib.pyplot.contourf with keyword arguments ‘kwargs’. For a list of ‘kwargs’ see the matplotlib contourf documentation

Parameters:
  • x (pybamm.Array) – The array to plot on the x axis. Can be of shape (M, N) or (N, 1)
  • y (pybamm.Array) – The array to plot on the y axis. Can be of shape (M, N) or (M, 1)
  • z (pybamm.Array) – The array to plot on the z axis. Is of shape (M, N)
  • xlabel (str, optional) – The label for the x axis
  • ylabel (str, optional) – The label for the y axis
  • title (str, optional) – The title for the plot
  • testing (bool, optional) – Whether to actually make the plot (turned off for unit tests)