.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/ex_12_plot_values.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_examples_ex_12_plot_values.py: Plot values ---------------- Here is an example of how to plot values with color scales. And also to plot an interpolated image. .. GENERATED FROM PYTHON SOURCE LINES 10-18 .. code-block:: Python from pprint import pprint import numpy as np import matplotlib.pyplot as plt from probeinterface import Probe, get_probe from probeinterface.plotting import plot_probe .. GENERATED FROM PYTHON SOURCE LINES 19-20 Download one probe: .. GENERATED FROM PYTHON SOURCE LINES 20-27 .. code-block:: Python manufacturer = 'neuronexus' probe_name = 'A1x32-Poly3-10mm-50-177' probe = get_probe(manufacturer, probe_name) probe.rotate(23) .. GENERATED FROM PYTHON SOURCE LINES 28-29 fake values .. GENERATED FROM PYTHON SOURCE LINES 29-32 .. code-block:: Python values = np.random.randn(32) .. GENERATED FROM PYTHON SOURCE LINES 33-34 plot with values .. GENERATED FROM PYTHON SOURCE LINES 34-42 .. code-block:: Python fig, ax = plt.subplots() poly, poly_contour = plot_probe(probe, contacts_values=values, cmap='jet', ax=ax, contact_kwargs={'alpha' : 1}, title=False) poly.set_clim(-2, 2) fig.colorbar(poly) .. image-sg:: /examples/images/sphx_glr_ex_12_plot_values_001.png :alt: ex 12 plot values :srcset: /examples/images/sphx_glr_ex_12_plot_values_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 43-44 generated an interpolated image and plot it on top .. GENERATED FROM PYTHON SOURCE LINES 44-55 .. code-block:: Python image, xlims, ylims = probe.to_image(values, pixel_size=4, method='linear') print(image.shape) fig, ax = plt.subplots() plot_probe(probe, ax=ax, title=False) im = ax.imshow(image, extent=xlims+ylims, origin='lower', cmap='jet') im.set_clim(-2,2) fig.colorbar(im) .. image-sg:: /examples/images/sphx_glr_ex_12_plot_values_002.png :alt: ex 12 plot values :srcset: /examples/images/sphx_glr_ex_12_plot_values_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none (127, 67) .. GENERATED FROM PYTHON SOURCE LINES 56-57 works with several interpolation methods .. GENERATED FROM PYTHON SOURCE LINES 57-69 .. code-block:: Python image, xlims, ylims = probe.to_image(values, num_pixel=1000, method='nearest') fig, ax = plt.subplots() plot_probe(probe, ax=ax, title=False) im = ax.imshow(image, extent=xlims+ylims, origin='lower', cmap='jet') im.set_clim(-2,2) fig.colorbar(im) plt.show() .. image-sg:: /examples/images/sphx_glr_ex_12_plot_values_003.png :alt: ex 12 plot values :srcset: /examples/images/sphx_glr_ex_12_plot_values_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.094 seconds) .. _sphx_glr_download_examples_ex_12_plot_values.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: ex_12_plot_values.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: ex_12_plot_values.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: ex_12_plot_values.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_