.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_gallery/guis/imgui_top.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_guis_imgui_top.py: ImGUI Header GUI ================ Basic examples demonstrating how to use create a header gui .. GENERATED FROM PYTHON SOURCE LINES 7-60 .. image-sg:: /_gallery/guis/images/sphx_glr_imgui_top_001.webp :alt: imgui top :srcset: /_gallery/guis/images/sphx_glr_imgui_top_001.webp :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/work/fastplotlib/fastplotlib/fastplotlib/graphics/features/_base.py:18: UserWarning: casting float64 array to float32 warn(f"casting {array.dtype} array to float32") | .. code-block:: Python # test_example = true import numpy as np import fastplotlib as fpl # subclass from EdgeWindow to make a custom ImGUI Window to place inside the figure! from fastplotlib.ui import EdgeWindow from imgui_bundle import imgui # make some initial data np.random.seed(0) xs = np.linspace(0, np.pi * 10, 100) ys = np.sin(xs) + np.random.normal(scale=0.0, size=100) data = np.column_stack([xs, ys]) # make a figure figure = fpl.Figure(size=(700, 560)) # make some scatter points at every 10th point figure[0, 0].add_scatter(data[::10], colors="cyan", sizes=15, name="sine-scatter", uniform_color=True) # place a line above the scatter figure[0, 0].add_line(data, thickness=3, colors="r", name="sine-wave", uniform_color=True) class ImguiExample(EdgeWindow): def __init__(self, figure, size, location, title): super().__init__(figure=figure, size=size, location=location, title=title, window_flags=imgui.WindowFlags_.no_title_bar | imgui.WindowFlags_.no_resize) def update(self): imgui.text("This is a top window") # make GUI instance gui = ImguiExample( figure, # the figure this GUI instance should live inside size=30, # width or height of the GUI window within the figure location="top", # the edge to place this window at title=" ", # window title ) # add it to the figure figure.add_gui(gui) 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.663 seconds) .. _sphx_glr_download__gallery_guis_imgui_top.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: imgui_top.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: imgui_top.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_