.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/pcolor_example.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_pcolor_example.py: Unevenly spaced data ==================== Basic demonstration of pcolor, which can deal with unevenly spaced data .. note:: Right now, we just do this with real/imaginary, but in principal, it should be easily possible to extend this to use domain coloring (and to use it in the main DCCT method) .. GENERATED FROM PYTHON SOURCE LINES 14-94 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/images/sphx_glr_pcolor_example_001.png :alt: colorscales independent -- small data, (real), (imag) :srcset: /auto_examples/images/sphx_glr_pcolor_example_001.png, /auto_examples/images/sphx_glr_pcolor_example_001_2_00x.png 2.00x :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_pcolor_example_002.png :alt: colorscales independent -- large data, (real), (imag) :srcset: /auto_examples/images/sphx_glr_pcolor_example_002.png, /auto_examples/images/sphx_glr_pcolor_example_002_2_00x.png 2.00x :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_pcolor_example_003.png :alt: colorscales independent, (real), (imag), (real), (imag) :srcset: /auto_examples/images/sphx_glr_pcolor_example_003.png, /auto_examples/images/sphx_glr_pcolor_example_003_2_00x.png 2.00x :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_pcolor_example_004.png :alt: re/im dependent, but two rows independent, (real), (imag), (real), (imag) :srcset: /auto_examples/images/sphx_glr_pcolor_example_004.png, /auto_examples/images/sphx_glr_pcolor_example_004_2_00x.png 2.00x :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_pcolor_example_005.png :alt: colorscales dependent -- large second, (real), (imag), (real), (imag) :srcset: /auto_examples/images/sphx_glr_pcolor_example_005.png, /auto_examples/images/sphx_glr_pcolor_example_005_2_00x.png 2.00x :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_pcolor_example_006.png :alt: colorscales dependent -- large first, (real), (imag), (real), (imag) :srcset: /auto_examples/images/sphx_glr_pcolor_example_006.png, /auto_examples/images/sphx_glr_pcolor_example_006_2_00x.png 2.00x :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_pcolor_example_007.png :alt: manually set vmin/vmax -- large second, (real), (imag), (real), (imag) :srcset: /auto_examples/images/sphx_glr_pcolor_example_007.png, /auto_examples/images/sphx_glr_pcolor_example_007_2_00x.png 2.00x :class: sphx-glr-multi-img .. code-block:: Python import pyspecdata as psp import matplotlib.pylab as plt from numpy import r_ def new_figure_and_grid(): fig = plt.figure() gs = plt.GridSpec(2, 2, hspace=0.5) ax_list = [] for j in range(2): for k in range(2): ax_list.append(fig.add_subplot(gs[j, k])) return ax_list run_to_checkpoint = 7 # allows us to run to different checkpoints. If # everything is working correctly, this should go up to 5 x = psp.nddata(r_[-5, -2, -1, -0.5, 0, 0.5, 5], "x") y = psp.nddata(3 * r_[-5, -2, -1, -0.5, 0, 0.5, 5], "y") z1 = plt.exp(-((y - 2) ** 2) - (x - 0) ** 2 / 2) + 1j * x z2 = 10 * z1 # {{{ plot the smaller data plt.figure() plt.suptitle("colorscales independent -- small data") mpbl = z1.pcolor(scale_independently=True) # }}} if run_to_checkpoint > 1: # {{{ plot the larger data plt.figure() plt.suptitle("colorscales independent -- large data") mpbl = z2.pcolor(scale_independently=True, mappable_list=[]) # }}} if run_to_checkpoint > 2: # {{{ independent ax_list = new_figure_and_grid() plt.suptitle("colorscales independent") z1.pcolor(scale_independently=True, ax1=ax_list[0], ax2=ax_list[1]) mpbl = z2.pcolor(scale_independently=True, ax1=ax_list[2], ax2=ax_list[3]) # }}} if run_to_checkpoint > 3: # {{{ independent rows, dependent columns ax_list = new_figure_and_grid() plt.suptitle("re/im dependent, but two rows independent") z1.pcolor(ax1=ax_list[0], ax2=ax_list[1]) z2.pcolor(ax1=ax_list[2], ax2=ax_list[3]) # }}} if run_to_checkpoint > 4: # {{{ small first, then large ax_list = new_figure_and_grid() plt.suptitle("colorscales dependent -- large second") mpbl = z1.pcolor(ax1=ax_list[0], ax2=ax_list[1]) mpbl = z2.pcolor(mappable_list=mpbl, ax1=ax_list[2], ax2=ax_list[3]) # }}} if run_to_checkpoint > 5: # {{{ large in first row, then small in second row ax_list = new_figure_and_grid() plt.suptitle("colorscales dependent -- large first") mpbl = z2.pcolor(ax1=ax_list[0], ax2=ax_list[1]) z1.pcolor(mappable_list=mpbl, ax1=ax_list[2], ax2=ax_list[3]) # }}} if run_to_checkpoint > 6: # {{{ manually set vmin and vmax ax_list = new_figure_and_grid() plt.suptitle("manually set vmin/vmax -- large second") z1.pcolor( ax1=ax_list[0], ax2=ax_list[1], vmin=-10, vmax=10, ) z2.pcolor( ax1=ax_list[2], ax2=ax_list[3], vmin=-150, vmax=150, ) # }}} plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 4.181 seconds) .. _sphx_glr_download_auto_examples_pcolor_example.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: pcolor_example.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: pcolor_example.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_