ModelPlotter#
- class fridom.framework.modules.animation.model_plotter.ModelPlotter(mz: ModelState)[source]#
Bases:
objectA model plotter contains the logic for creating and updating a figure object
Description#
The Model Plotter must be overwriten by child classes to implement the following methods:
- create_figure():
create a figure object (e.g. matplotlib figure)
- prepare_arguments(mz: ModelState) -> dict:
prepare the arguments for the update_figure method (e.g. extract the field to be plotted and convert it to numpy/xarray)
- update_figure(fig, **kwargs):
update the figure object with the given arguments from the prepare_arguments method
- convert_to_img(fig):
convert the figure object to a numpy image array. If matplotlib is used, this method does not need to be overwritten. However, if a different plotting library is used, this method must be overwritten.
- __init__()#
Methods
__init__()convert_to_img(fig)This method should convert the figure object to a numpy image array.
This method should create a figure object (e.g. matplotlib figure) and return it.
This method should prepare the arguments for the update_figure method.
update_figure(fig, *args, **kwargs)This method should update the figure object with the given model state.
Examples using
fridom.framework.modules.animation.ModelPlotter#- static create_figure()[source]#
This method should create a figure object (e.g. matplotlib figure) and return it.
- static prepare_arguments(mz: ModelState) dict[source]#
This method should prepare the arguments for the update_figure method.