.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/more_demos/010-slices.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_gallery_more_demos_010-slices.py: Display of 3D data ====================== .. image:: ../../_static/cigvis/more_demos/010.png :alt: image :align: center .. GENERATED FROM PYTHON SOURCE LINES 10-46 .. code-block:: default # sphinx_gallery_thumbnail_path = '_static/cigvis/more_demos/010.png' import numpy as np import cigvis from pathlib import Path root = Path(__file__).resolve().parent.parent.parent def show(d): # show1 nodes1 = cigvis.create_slices(d) # add colorbar, method1 nodes2 = cigvis.create_slices(d) nodes2 += cigvis.create_colorbar_from_nodes(nodes2, 'Amplitude', select='slices') # add colorbar, method2, using create_colorbar. This is the general usage. nodes3 = cigvis.create_slices(d, cmap='Petrel', clim=[d.min(), d.max()]) cbar = cigvis.create_colorbar(cmap='Petrel', clim=[d.min(), d.max()], label_str='Amplitude') nodes3.append(cbar) cigvis.plot3D([nodes1, nodes2, nodes3], grid=(1, 3), size=(1500, 500), cbar_region_ratio=0.18, savename='example.png') if __name__ == '__main__': sxp = root / 'data/co2/sx.dat' ni, nx, nt = 192, 192, 240 sx = np.memmap(sxp, np.float32, 'c', shape=(ni, nx, nt)) show(sx) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.000 seconds) .. _sphx_glr_download_gallery_more_demos_010-slices.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 010-slices.py <010-slices.py>` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 010-slices.ipynb <010-slices.ipynb>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_