.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/ex_08_more_plotting_examples.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_08_more_plotting_examples.py: More plotting examples ---------------------- Here are some examples to showcase several plotting scenarios. .. GENERATED FROM PYTHON SOURCE LINES 10-11 Import .. GENERATED FROM PYTHON SOURCE LINES 11-19 .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from probeinterface import Probe, ProbeGroup from probeinterface.plotting import plot_probe, plot_probegroup from probeinterface import generate_multi_columns_probe, generate_linear_probe .. GENERATED FROM PYTHON SOURCE LINES 20-21 Some examples in 2d .. GENERATED FROM PYTHON SOURCE LINES 21-60 .. code-block:: Python fig, ax = plt.subplots() probe0 = generate_multi_columns_probe() plot_probe(probe0, ax=ax) # give each probe a different color probe1 = generate_linear_probe(num_elec=9) probe1.rotate(theta=15) probe1.move([200, 0]) plot_probe(probe1, ax=ax, contacts_colors=['red', 'cyan', 'yellow'] * 3) # prepare yourself for carnival! probe2 = generate_linear_probe() probe2.rotate(theta=-35) probe2.move([400, 0]) n = probe2.get_contact_count() rand_colors = np.random.rand(n, 3) plot_probe(probe2, ax=ax, contacts_colors=rand_colors, probe_shape_kwargs={'facecolor': 'purple', 'edgecolor': 'k', 'lw': 0.5, 'alpha': 0.2}) # and make some alien probes probe3 = Probe() positions = [[0, 0], [0, 50], [25, 77], [45, 27]] shapes = ['circle', 'square', 'rect', 'circle'] params = [{'radius': 10}, {'width': 30}, {'width': 20, 'height': 12}, {'radius': 13}] probe3.set_contacts(positions=positions, shapes=shapes, shape_params=params) probe3.create_auto_shape(probe_type='rect') probe3.rotate(theta=25) probe3.move([600, 0]) plot_probe(probe3, ax=ax, contacts_colors=['b', 'c', 'g', 'y']) ax.set_xlim(-100, 700) ax.set_ylim(-200, 350) ax.set_aspect('equal') .. image-sg:: /examples/images/sphx_glr_ex_08_more_plotting_examples_001.png :alt: Probe - 4ch :srcset: /examples/images/sphx_glr_ex_08_more_plotting_examples_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 61-62 Some examples in 3dĀ for the romantic who likes flowers... .. GENERATED FROM PYTHON SOURCE LINES 62-89 .. code-block:: Python fig = plt.figure() ax = fig.add_subplot(1, 1, 1, projection='3d') n = 8 for i in range(n): probe = generate_multi_columns_probe(num_columns=3, num_contact_per_column=[8, 9, 8], xpitch=20, ypitch=20, y_shift_per_column=[0, -10, 0]).to_3d() probe.rotate(theta=35, center=[0, 0, 0], axis=[0, 1, 0]) probe.move([100, 50, 0]) probe.rotate(theta=i * 360 / n, center=[0, 0, 0], axis=[0, 0, 1]) plot_probe(probe, ax=ax, probe_shape_kwargs={'facecolor': ['purple', 'cyan'][i % 2], 'edgecolor': 'k', 'lw': 0.5, 'alpha': 0.2}) probe = generate_linear_probe(num_elec=24, ypitch=20).to_3d() probe.move([0, 0, -450]) plot_probe(probe, ax=ax) lims = -450, 450 ax.set_xlim(*lims) ax.set_ylim(*lims) ax.set_zlim(*lims) plt.show() .. image-sg:: /examples/images/sphx_glr_ex_08_more_plotting_examples_002.png :alt: Probe - 24ch :srcset: /examples/images/sphx_glr_ex_08_more_plotting_examples_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.233 seconds) .. _sphx_glr_download_examples_ex_08_more_plotting_examples.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: ex_08_more_plotting_examples.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: ex_08_more_plotting_examples.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: ex_08_more_plotting_examples.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_