.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_gallery/line/inf_line.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__gallery_line_inf_line.py: Infinite Lines ============== Draw infinite vertical and horizontal lines to mark positions on a plot. .. GENERATED FROM PYTHON SOURCE LINES 7-44 .. image-sg:: /_gallery/line/images/sphx_glr_inf_line_001.webp :alt: inf line :srcset: /_gallery/line/images/sphx_glr_inf_line_001.webp :class: sphx-glr-single-img .. code-block:: Python # test_example = true import fastplotlib as fpl import numpy as np figure = fpl.Figure(size=(700, 560)) xs = np.linspace(0, 4 * np.pi, 100) ys = np.sin(xs) data = np.column_stack([xs, ys]) figure[0, 0].add_line(data, thickness=2, colors="w") # vertical lines at the zero-crossings, one color per line by passing a list of colors zero_crossings = np.array([0, np.pi, 2 * np.pi, 3 * np.pi, 4 * np.pi]) figure[0, 0].add_inf_line( zero_crossings, axis="x", colors=["r", "g", "b", "c", "m"], thickness=2 ) # dashed horizontal lines at the sine bounds, provided as a 1D array of y-values figure[0, 0].add_inf_line( np.array([-1.0, 1.0]), axis="y", colors="gray", thickness=2, dash_pattern="--", ) figure.show() # NOTE: fpl.loop.run() should not be used for interactive sessions # See the "JupyterLab and IPython" section in the user guide if __name__ == "__main__": print(__doc__) fpl.loop.run() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.534 seconds) .. _sphx_glr_download__gallery_line_inf_line.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: inf_line.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: inf_line.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_