DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

I want to know how to use the plot drawing series.

Open nehonpa opened this issue 10 months ago • 1 comments

Version of Dear PyGui

Version:11.1 Operating Windows 11

My Issue/Question

I want to know how to use the plot drawing series. The document only mentions ordinary coordinate graphs, and I have no idea how to use the other legend styles.

add_plot_legend add_bar_series add_bar_series, add_2d_histogram_series, add_area_series, add_bar_series, add_bar_series, add_candle_series, add_custom_series, add_error_series, add_heat_series, add_histogram_series, add_hline_series, add_image_series, add_line_series, add_pie_series, add_scatter_series, add_series_value, add_shade_series, add_stair_series, add_stem_series, add_vline_series, custom_series, These methods are completely unused. Can you tell me?

To Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots/Video

XXX (you can drag files here)

Standalone, minimal, complete and verifiable example

# Here's some code anyone can copy and paste to reproduce your issue
import dearpygui.dearpygui as dpg
from math import sin

dpg.create_context()

# creating data
sindatax = []
sindatay = []
for i in range(0, 500):
    sindatax.append(i / 1000)
    sindatay.append(0.5 + 0.5 * sin(50 * i / 1000))

with dpg.window(label="Tutorial"):
    # create plot
    with dpg.plot(label="Line Series", height=400, width=400):
        # optionally create legend
        dpg.add_bar_series(dpg.mvXAxis,dpg.mvYAxis)
        
        # REQUIRED: create x and y axes
        dpg.add_plot_axis(dpg.mvXAxis, label="x")
        dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="y_axis")

        # series belong to a y axis
        dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="y_axis")

dpg.create_viewport(title='Custom Title', width=800, height=600)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

nehonpa avatar Mar 03 '25 06:03 nehonpa

Take a look at demo.py, I believe it shows how to use all of them. And here's how to run it (it's mentioned in the Readme at the project home page):

https://github.com/hoffstadt/DearPyGui/tree/master?tab=readme-ov-file#demo

v-ein avatar Mar 03 '25 07:03 v-ein