.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/Markers/plot_points.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_Markers_plot_points.py: Points ====== Mark specific (x, y) positions on a 1-D plot with :meth:`~anyplotlib.figure_plots.Plot1D.add_points`. Use ``markers["points"]["name"].set(...)`` to update them live. .. GENERATED FROM PYTHON SOURCE LINES 9-26 .. code-block:: Python import numpy as np import anyplotlib as vw x = np.linspace(0, 4 * np.pi, 512) signal = np.sin(x) fig, ax = vw.subplots(1, 1, figsize=(560, 300)) v = ax.plot(signal, axes=[x], units="rad") peak_x = np.array([np.pi / 2, 5 * np.pi / 2, 9 * np.pi / 2]) offsets = np.column_stack([peak_x, np.sin(peak_x)]) v.add_points(offsets, name="peaks", sizes=8, color="#ff1744", facecolors="#ff174433", label="peaks", labels=["P1", "P2", "P3"]) fig .. raw:: html
.. GENERATED FROM PYTHON SOURCE LINES 27-29 Live update ----------- .. GENERATED FROM PYTHON SOURCE LINES 29-33 .. code-block:: Python v.markers["points"]["peaks"].set(sizes=12, color="#ffcc00", facecolors="#ffcc0033") fig .. raw:: html
.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.041 seconds) .. _sphx_glr_download_auto_examples_Markers_plot_points.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_points.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_points.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_points.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_