.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/utils/multi_panels_plots.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_utils_multi_panels_plots.py: ==================== Multi-panels figures ==================== The function `cortex.export.plot_panels` plots a number of 3d views of a given volume, in the same matplotlib figure. It does that by saving a temporary image for each view, and then aggregating them in the same figure. The function needs to be run on a system with a display, since it will launch a webgl viewer. The best way to get the expected results is to keep the webgl viewer visible during the process. The selection of views and the aggregation is controlled by a list of "panels". Examples of panels can be imported with: from cortex.export import params_flatmap_lateral_medial from cortex.export import params_occipital_triple_view .. GENERATED FROM PYTHON SOURCE LINES 21-31 .. code-block:: Python import os import tempfile import numpy as np import matplotlib.pyplot as plt import cortex subject = 'S1' .. GENERATED FROM PYTHON SOURCE LINES 32-33 create some artificial data .. GENERATED FROM PYTHON SOURCE LINES 33-38 .. code-block:: Python shape = cortex.db.get_xfm(subject, 'identity').shape data = np.arange(np.product(shape)).reshape(shape) volume = cortex.Volume(data, subject=subject, xfmname='identity') .. GENERATED FROM PYTHON SOURCE LINES 39-40 Show examples of multi-panels figures .. GENERATED FROM PYTHON SOURCE LINES 40-49 .. code-block:: Python params = cortex.export.params_flatmap_lateral_medial cortex.export.plot_panels(volume, **params) plt.show() params = cortex.export.params_occipital_triple_view cortex.export.plot_panels(volume, **params) plt.show() .. GENERATED FROM PYTHON SOURCE LINES 50-51 List all predefined angles .. GENERATED FROM PYTHON SOURCE LINES 51-65 .. code-block:: Python base_name = os.path.join(tempfile.mkdtemp(), 'fig') list_angles = list(cortex.export.save_views.angle_view_params.keys()) filenames = cortex.export.save_3d_views( volume, base_name=base_name, list_angles=list_angles, list_surfaces=['inflated'] * len(list_angles)) for filename, angle in zip(filenames, list_angles): plt.imshow(plt.imread(filename)) plt.axis('off') plt.title(angle) plt.show() .. GENERATED FROM PYTHON SOURCE LINES 66-67 List all predefined surfaces .. GENERATED FROM PYTHON SOURCE LINES 67-81 .. code-block:: Python base_name = os.path.join(tempfile.mkdtemp(), 'fig') list_surfaces = list(cortex.export.save_views.unfold_view_params.keys()) filenames = cortex.export.save_3d_views( volume, base_name=base_name, list_angles=['lateral_pivot'] * len(list_surfaces), list_surfaces=list_surfaces) for filename, surface in zip(filenames, list_surfaces): plt.imshow(plt.imread(filename)) plt.axis('off') plt.title(surface) plt.show() .. _sphx_glr_download_auto_examples_utils_multi_panels_plots.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: multi_panels_plots.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: multi_panels_plots.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_