.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/utils/plot_mosaic.py" .. LINE NUMBERS ARE GIVEN BELOW. .. 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_utils_plot_mosaic.py: =============================== Mosaic plot =============================== The function `mosaic` plots all of the slices in a volume in a matplotlib figure. Good for quick visualization or testing of volumes. .. GENERATED FROM PYTHON SOURCE LINES 11-37 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/utils/images/sphx_glr_plot_mosaic_001.png :alt: plot mosaic :srcset: /auto_examples/utils/images/sphx_glr_plot_mosaic_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/utils/images/sphx_glr_plot_mosaic_002.png :alt: plot mosaic :srcset: /auto_examples/utils/images/sphx_glr_plot_mosaic_002.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/utils/images/sphx_glr_plot_mosaic_003.png :alt: plot mosaic :srcset: /auto_examples/utils/images/sphx_glr_plot_mosaic_003.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none /home/runner/work/pycortex/pycortex/examples/utils/plot_mosaic.py:17: DeprecationWarning: get_data() is deprecated in favor of get_fdata(), which has a more predictable return type. To obtain get_data() behavior going forward, use numpy.asanyarray(img.dataobj). * deprecated from version: 3.0 * Will raise as of version: 5.0 volume_arr = cortex.db.get_xfm('S1', 'fullhead').reference.get_data().T | .. code-block:: default # sphinx_gallery_thumbnail_number = 3 import cortex import matplotlib.pyplot as plt # load reference functional image for test purposes volume_arr = cortex.db.get_xfm('S1', 'fullhead').reference.get_data().T # volume_arr is a (31,100,100) ndarray # with no args mosaic slices this volume in the first dimension plt.figure() cortex.mosaic(volume_arr) # slices along a different dimension can be plotted using the dim param # here coronal plt.figure() cortex.mosaic(volume_arr, dim=1) # kwargs are passed through to imshow plt.figure() cortex.mosaic(volume_arr, cmap=plt.cm.gray, vmin=0, vmax=1500) # mosaic always returns the mosaic image along with info about its shape # here show=False so we don't generate another plot mosaic_arr, (nwide, ntall) = cortex.mosaic(volume_arr, show=False) # mosaic_arr is 607 x 607, with nwide = 6, ntall = 6 .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.272 seconds) .. _sphx_glr_download_auto_examples_utils_plot_mosaic.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_mosaic.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_mosaic.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_