.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/ex2/plot_test.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. or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_ex2_plot_test.py: An example with a plot ======================= This is just for testing. .. GENERATED FROM PYTHON SOURCE LINES 13-22 .. code-block:: Python import matplotlib.pyplot as plt import oslumen as ol import mplstyle_oslumen import numpy as np plt.style.use("oslumen") .. GENERATED FROM PYTHON SOURCE LINES 24-25 A comment .. GENERATED FROM PYTHON SOURCE LINES 25-48 .. code-block:: Python def model(x, p): return x ** (2 * p + 1) / (1 + x ** (2 * p)) pparam = dict( xlabel="Voltage (mV)", ylabel=r"Current ($\mu$A)", title="Plot with the oslumen style", ) x = np.linspace(0.75, 1.25, 201) fig, ax = plt.subplots() for p in [10, 15, 20, 30, 50, 100]: ax.plot(x, model(x, p), label=p) ax.legend(title="Order") ax.autoscale(tight=True) ax.set(**pparam) plt.tight_layout() .. image-sg:: /examples/ex2/images/sphx_glr_plot_test_001.png :alt: Plot with the oslumen style :srcset: /examples/ex2/images/sphx_glr_plot_test_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 49-50 A map .. GENERATED FROM PYTHON SOURCE LINES 50-62 .. code-block:: Python fig, ax = plt.subplots() x = y = np.linspace(0, 1, 300) x, y = np.meshgrid(x, y) z = np.cos(4 * np.pi * x**2) * np.sin(2 * np.pi * y) plt.pcolormesh(x, y, z, cmap="oslumen") plt.xlabel("x (nm)") plt.ylabel("y (nm)") plt.title("Plot with the oslumen colormap") ax.set_aspect(1) plt.colorbar() plt.show() .. image-sg:: /examples/ex2/images/sphx_glr_plot_test_002.png :alt: Plot with the oslumen colormap :srcset: /examples/ex2/images/sphx_glr_plot_test_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.039 seconds) **Estimated memory usage:** 231 MB .. _sphx_glr_download_examples_ex2_plot_test.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/oslumen/oslumen.github.io/doc?urlpath=lab/tree/notebooks/examples/ex2/plot_test.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_test.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_test.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_test.zip `