To plot simulation results (possibly along with experimental data), different methods are viable:
In the following, we will explain the last of these three methods.
MatPlotLib-based plotting functions are provided by Python module ba_plot
that is part of the bornagain
Python package.
It is typically used through
from bornagain import ba_plot as bp
It provides the functions
plot_simulation_result(result, **plotargs) # plot one Datafield
plot_multicurve(results, **plotargs) # several 1d Datafields in one frame
make_plot(results, ncol, **plotargs) # one Datafield per frame in a grid
make_plot_row(results, **plotargs) # one Datafield per frame in a row
where result
is a Datafield as returned by simulation.simulate()
,
and results
is a list of Datafields.
To finalize a plot, call one of
bp.plt.show() # launch MatPlotLib window to display the plot
bp.export(**plotargs) # write the plot to an image file (explained below)
See
$...$
typeset with LaTeXSee also:
The functions documented in this section of the online manual
are all implemented in the Python module
ba_plot
.
If our plot functions are not versatile enough for your needs, then copy, rename, and modify them.