.. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_raidal_slices.py: Plotting radial slices ====================== This example shows how to plot slices of constant radial distance from a MAS model output. First, load the required modules. .. code-block:: default from psipy.model import MASOutput import matplotlib.pyplot as plt Next, load a set of MAS output files. You will need to change this line to point to a folder with MAS files in them. .. code-block:: default mas_path = '/Users/dstansby/github/psipy/data/helio' model = MASOutput(mas_path) Each MAS model contains a number of variables. The variable names can be accessed using the ``.variables`` attribute. .. code-block:: default print(model.variables) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none ['p', 't', 'va', 'br', 'vp', 'jp', 'jr', 'bp', 'vr', 'bt', 'vt', 'rho', 'jt'] Set parameters for plotting. The first line will give us a horizontal errorbar underneath the plots. The second line is the index to select for the radial slice. .. code-block:: default cbar_kwargs = {'orientation': 'horizontal'} r_idx = 139 Plot the slices .. code-block:: default fig, axs = plt.subplots(nrows=2, ncols=3) ax = axs[0, 0] model['vr'].plot_radial_cut(r_idx, ax=ax, cbar_kwargs=cbar_kwargs) model['br'].contour_radial_cut(r_idx, levels=[0], ax=ax, colors='white') ax = axs[0, 1] model['vp'].plot_radial_cut(r_idx, ax=ax, cbar_kwargs=cbar_kwargs) model['br'].contour_radial_cut(r_idx, levels=[0], ax=ax, colors='black') ax = axs[0, 2] model['vt'].plot_radial_cut(r_idx, ax=ax, cbar_kwargs=cbar_kwargs) model['br'].contour_radial_cut(r_idx, levels=[0], ax=ax, colors='black') ax = axs[1, 0] model['rho'].plot_radial_cut(r_idx, ax=ax, cbar_kwargs=cbar_kwargs) model['br'].contour_radial_cut(r_idx, levels=[0], ax=ax, colors='white') ax = axs[1, 1] model['p'].plot_radial_cut(r_idx, ax=ax, cbar_kwargs=cbar_kwargs) model['br'].contour_radial_cut(r_idx, levels=[0], ax=ax, colors='white') plt.show() .. image:: /auto_examples/images/sphx_glr_plot_raidal_slices_001.png :alt: vr, r=236.46$R_{\odot}$, vp, r=235.72$R_{\odot}$, vt, r=235.72$R_{\odot}$, rho, r=235.72$R_{\odot}$, p, r=235.72$R_{\odot}$ :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.035 seconds) .. _sphx_glr_download_auto_examples_plot_raidal_slices.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_raidal_slices.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_raidal_slices.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_