.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/quickflat/plot_make_figure.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_quickflat_plot_make_figure.py: ======================== Plot a 2D static flatmap ======================== quickflat visualizations use matplotlib to generate figure-quality 2D flatmaps. Similar to webgl, this tool uses pixel-based mapping to project functional data onto the cortical surfaces. This demo will use randomly generated data and plot a flatmap. Different options to visualize the data will be demonstrated. **Some words on the `rechache` parameter before we begin:** Setting the `recache=True` parameter recaches the flatmap cache located in //cache. By default intermediate steps for a flatmap are cached after the first generation to speed up the process for the future. If any of the intermediate steps changes, the flatmap generation may fail. `recache=True` will load these intermediate steps new. This can be helpful if you think there is no reason that the `quickflat.make_figure` to fail but it nevertheless fails. Try it, it's magic! .. GENERATED FROM PYTHON SOURCE LINES 25-67 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/quickflat/images/sphx_glr_plot_make_figure_001.png :alt: plot make figure :srcset: /auto_examples/quickflat/images/sphx_glr_plot_make_figure_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/quickflat/images/sphx_glr_plot_make_figure_002.png :alt: plot make figure :srcset: /auto_examples/quickflat/images/sphx_glr_plot_make_figure_002.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/quickflat/images/sphx_glr_plot_make_figure_003.png :alt: plot make figure :srcset: /auto_examples/quickflat/images/sphx_glr_plot_make_figure_003.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/quickflat/images/sphx_glr_plot_make_figure_004.png :alt: plot make figure :srcset: /auto_examples/quickflat/images/sphx_glr_plot_make_figure_004.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/quickflat/images/sphx_glr_plot_make_figure_005.png :alt: plot make figure :srcset: /auto_examples/quickflat/images/sphx_glr_plot_make_figure_005.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/quickflat/images/sphx_glr_plot_make_figure_006.png :alt: plot make figure :srcset: /auto_examples/quickflat/images/sphx_glr_plot_make_figure_006.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Failed to get connection ** (inkscape:5402): CRITICAL **: 01:31:11.806: dbus_g_proxy_new_for_name: assertion 'connection != NULL' failed ** (inkscape:5402): CRITICAL **: 01:31:11.806: dbus_g_proxy_call: assertion 'DBUS_IS_G_PROXY (proxy)' failed ** (inkscape:5402): CRITICAL **: 01:31:11.806: dbus_g_connection_register_g_object: assertion 'connection != NULL' failed Failed to get connection ** (inkscape:5406): CRITICAL **: 01:31:12.783: dbus_g_proxy_new_for_name: assertion 'connection != NULL' failed ** (inkscape:5406): CRITICAL **: 01:31:12.783: dbus_g_proxy_call: assertion 'DBUS_IS_G_PROXY (proxy)' failed ** (inkscape:5406): CRITICAL **: 01:31:12.783: dbus_g_connection_register_g_object: assertion 'connection != NULL' failed Failed to get connection ** (inkscape:5409): CRITICAL **: 01:31:13.881: dbus_g_proxy_new_for_name: assertion 'connection != NULL' failed ** (inkscape:5409): CRITICAL **: 01:31:13.881: dbus_g_proxy_call: assertion 'DBUS_IS_G_PROXY (proxy)' failed ** (inkscape:5409): CRITICAL **: 01:31:13.881: dbus_g_connection_register_g_object: assertion 'connection != NULL' failed Failed to get connection ** (inkscape:5412): CRITICAL **: 01:31:14.979: dbus_g_proxy_new_for_name: assertion 'connection != NULL' failed ** (inkscape:5412): CRITICAL **: 01:31:14.979: dbus_g_proxy_call: assertion 'DBUS_IS_G_PROXY (proxy)' failed ** (inkscape:5412): CRITICAL **: 01:31:14.979: dbus_g_connection_register_g_object: assertion 'connection != NULL' failed Failed to get connection ** (inkscape:5415): CRITICAL **: 01:31:16.268: dbus_g_proxy_new_for_name: assertion 'connection != NULL' failed ** (inkscape:5415): CRITICAL **: 01:31:16.269: dbus_g_proxy_call: assertion 'DBUS_IS_G_PROXY (proxy)' failed ** (inkscape:5415): CRITICAL **: 01:31:16.269: dbus_g_connection_register_g_object: assertion 'connection != NULL' failed | .. code-block:: default import cortex import matplotlib.pyplot as plt import numpy as np np.random.seed(1234) # Create a random pycortex Volume volume = cortex.Volume.random(subject='S1', xfmname='retinotopy') # Plot a flatmap with the data projected onto the surface # By default ROIs and their labels will be overlaid to the plot # Also a colorbar will be added _ = cortex.quickflat.make_figure(volume) plt.show() # The cortex.quickshow method is a pointer to quickflat.make_figure # and will plot exactly the same as the above plot _ = cortex.quickshow(volume) plt.show() # Highlight the curvature _ = cortex.quickflat.make_figure(volume, with_curvature=True) plt.show() # Remove ROI labels from the plot _ = cortex.quickflat.make_figure(volume, with_curvature=True, with_labels=False) plt.show() # Remove ROIs from the plot _ = cortex.quickflat.make_figure(volume, with_curvature=True, with_rois=False) plt.show() # Remove the colorbar from the plot cortex.quickflat.make_figure(volume, with_curvature=True, with_colorbar=False) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 11.182 seconds) .. _sphx_glr_download_auto_examples_quickflat_plot_make_figure.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_make_figure.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_make_figure.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_