.. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here <sphx_glr_download_auto_examples_plot_tutorial_04.py>` to download the full example code
.. rst-class:: sphx-glr-example-title
This tutorial covers the layout and view options provided by surfplot
.
For variety, let's import the left and right Conte69 midthickness surface directly using :func:`~brainspace.datasets.load_conte69`. Then, we'll make a blank surface plot using the default layout and view, which is a 2x2 'grid' of lateral and medial views that is identical to the default setup in Connectome Workbench.
from brainspace.datasets import load_conte69
from surfplot import Plot
lh, rh = load_conte69()
p = Plot(lh, rh)
fig = p.build()
fig.show()
.. image-sg:: /auto_examples/images/sphx_glr_plot_tutorial_04_001.png :alt: plot tutorial 04 :srcset: /auto_examples/images/sphx_glr_plot_tutorial_04_001.png :class: sphx-glr-single-img
The layout can be adjusted with the layout parameter, and has 3 options: 'grid' (default, shown above), 'row', or 'column'. The size and zoom parameters will have to be adjusted based on the layout and number of views.
Above we see that 'grid' gives us a views-by-hemisphere grid, where the left hemisphere is the left column and the right hemisphere is the right column. Meanwhile, the 'row' layout gives a single horizontal row of brains:
p = Plot(lh, rh, size=(800, 200), zoom=1.2, layout='row')
fig = p.build()
fig.show()
.. image-sg:: /auto_examples/images/sphx_glr_plot_tutorial_04_002.png :alt: plot tutorial 04 :srcset: /auto_examples/images/sphx_glr_plot_tutorial_04_002.png :class: sphx-glr-single-img
The 'column' layout gives a single vertical column of brains.
p = Plot(lh, rh, size=(200, 600), zoom=1.6, layout='column')
fig = p.build()
fig.show()
# sphinx_gallery_thumbnail_number = 3
.. image-sg:: /auto_examples/images/sphx_glr_plot_tutorial_04_003.png :alt: plot tutorial 04 :srcset: /auto_examples/images/sphx_glr_plot_tutorial_04_003.png :class: sphx-glr-single-img
As well, it's also possible to plot just one hemisphere. If the layout is set as default ('grid'), then a single hemisphere is plotted as row:
p = Plot(lh, size=(400, 200), zoom=1.2)
fig = p.build()
fig.show()
.. image-sg:: /auto_examples/images/sphx_glr_plot_tutorial_04_004.png :alt: plot tutorial 04 :srcset: /auto_examples/images/sphx_glr_plot_tutorial_04_004.png :class: sphx-glr-single-img
surfplot
makes it easy to configure the view(s) you wish to use. One or
more views can be specified through the views parameter. As we've seen
before, the default is to include lateral and medial views. It is also
possible to show just one view:
p = Plot(lh, rh, size=(400, 200), zoom=1.2, views='lateral')
fig = p.build()
fig.show()
.. image-sg:: /auto_examples/images/sphx_glr_plot_tutorial_04_005.png :alt: plot tutorial 04 :srcset: /auto_examples/images/sphx_glr_plot_tutorial_04_005.png :class: sphx-glr-single-img
It is also possible to show more than just lateral and medial views, such as 'posterior'. Note that views are plotted in order in which they appear in the list:
p = Plot(lh, rh, size=(500, 400), zoom=1.4, views=['lateral', 'posterior'])
fig = p.build()
fig.show()
.. image-sg:: /auto_examples/images/sphx_glr_plot_tutorial_04_006.png :alt: plot tutorial 04 :srcset: /auto_examples/images/sphx_glr_plot_tutorial_04_006.png :class: sphx-glr-single-img
All possible views are shown here (the right hemisphere for brevity):
all_views = ['lateral', 'medial', 'dorsal', 'ventral', 'anterior', 'posterior']
p = Plot(surf_rh=rh, size=(900, 200), zoom=.8, layout='row', views=all_views)
fig = p.build()
fig.show()
.. image-sg:: /auto_examples/images/sphx_glr_plot_tutorial_04_007.png :alt: plot tutorial 04 :srcset: /auto_examples/images/sphx_glr_plot_tutorial_04_007.png :class: sphx-glr-single-img
Views can also be mirrored when both hemipsheres are plotted and layout is either 'row' or 'column'. Specifically, the right hemisphere view order is reversed. For example, plotting default lateral and medial views and setting mirror_views=True will situate the medial views in the middle for a symmetrical figure:
p = Plot(lh, rh, size=(800, 200), zoom=1.2, layout='row', mirror_views=True)
fig = p.build()
fig.show()
.. image-sg:: /auto_examples/images/sphx_glr_plot_tutorial_04_008.png :alt: plot tutorial 04 :srcset: /auto_examples/images/sphx_glr_plot_tutorial_04_008.png :class: sphx-glr-single-img
Finally, it is possible to flip the left and right hemisphere. This is useful when plotting just the 'anterior' or 'ventral' for both hemispheres. For example:
p = Plot(lh, rh, size=(200, 200), zoom=3, views='anterior', flip=True)
fig = p.build()
fig.show()
.. image-sg:: /auto_examples/images/sphx_glr_plot_tutorial_04_009.png :alt: plot tutorial 04 :srcset: /auto_examples/images/sphx_glr_plot_tutorial_04_009.png :class: sphx-glr-single-img
.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.961 seconds)
.. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_tutorial_04.py <plot_tutorial_04.py>` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_tutorial_04.ipynb <plot_tutorial_04.ipynb>`
.. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_