From 9194b5e9e4d7b72bf08d01c0fde6ff78be36215e Mon Sep 17 00:00:00 2001 From: sara Date: Sat, 6 Nov 2021 20:11:11 +0100 Subject: An graphischer Darstellung weitergearbeitet --- src/Test_Plots/test2_axis_limis.py | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/Test_Plots/test2_axis_limis.py (limited to 'src/Test_Plots/test2_axis_limis.py') diff --git a/src/Test_Plots/test2_axis_limis.py b/src/Test_Plots/test2_axis_limis.py new file mode 100644 index 0000000..bdfeda1 --- /dev/null +++ b/src/Test_Plots/test2_axis_limis.py @@ -0,0 +1,40 @@ +import dearpygui.dearpygui as dpg +from math import sin, cos + +dpg.create_context() + +sindatax = [] +sindatay = [] +for i in range(0, 500): + sindatax.append(i / 1000) + sindatay.append(0.5 + 0.5 * sin(50 * i / 1000)) + +def update_series(): + + cosdatax = [] + cosdatay = [] + for i in range(0, 500): + cosdatax.append(i / 1000) + cosdatay.append(0.5 + 0.5 * cos(50 * i / 1000)) + dpg.set_value('series_tag', [cosdatax, cosdatay]) + dpg.set_item_label('series_tag', "0.5 + 0.5 * cos(x)") + +with dpg.window(label="Tutorial", tag="win"): + dpg.add_button(label="Update Series", callback=update_series) + # create plot + with dpg.plot(label="Line Series", height=400, width=400): + # optionally create legend + dpg.add_plot_legend() + + # 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", tag="series_tag") + +dpg.create_viewport(title='Custom Title', width=800, height=600) +dpg.setup_dearpygui() +dpg.show_viewport() +dpg.start_dearpygui() +dpg.destroy_context() -- cgit v1.2.1