aboutsummaryrefslogtreecommitdiffstats
path: root/src/Test_Plots/test5_annotations.py
diff options
context:
space:
mode:
authorsara <sara.halter@gmx.ch>2021-11-06 20:11:11 +0100
committersara <sara.halter@gmx.ch>2021-11-06 20:11:11 +0100
commit9194b5e9e4d7b72bf08d01c0fde6ff78be36215e (patch)
tree0e5bcd30ed089c0674166cbcb995ca955e7ee88b /src/Test_Plots/test5_annotations.py
parentAn scr gearbeitet (diff)
downloadFading-9194b5e9e4d7b72bf08d01c0fde6ff78be36215e.tar.gz
Fading-9194b5e9e4d7b72bf08d01c0fde6ff78be36215e.zip
An graphischer Darstellung weitergearbeitet
Diffstat (limited to 'src/Test_Plots/test5_annotations.py')
-rw-r--r--src/Test_Plots/test5_annotations.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Test_Plots/test5_annotations.py b/src/Test_Plots/test5_annotations.py
new file mode 100644
index 0000000..9deff6b
--- /dev/null
+++ b/src/Test_Plots/test5_annotations.py
@@ -0,0 +1,32 @@
+import dearpygui.dearpygui as dpg
+from math import sin
+
+dpg.create_context()
+
+
+sindatax = []
+sindatay = []
+for i in range(0, 100):
+ sindatax.append(i / 100)
+ sindatay.append(0.5 + 0.5 * sin(50 * i / 100))
+
+with dpg.window(label="Tutorial", width=400, height=400):
+ with dpg.plot(label="Annotations", height=-1, width=-1):
+ dpg.add_plot_legend()
+ dpg.add_plot_axis(dpg.mvXAxis, label="x")
+ dpg.add_plot_axis(dpg.mvYAxis, label="y")
+ dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent=dpg.last_item())
+
+ # annotations belong to the plot NOT axis
+ dpg.add_plot_annotation(label="BL", default_value=(0.25, 0.25), offset=(-15, 15), color=[255, 255, 0, 255])
+ dpg.add_plot_annotation(label="BR", default_value=(0.75, 0.25), offset=(15, 15), color=[255, 255, 0, 255])
+ dpg.add_plot_annotation(label="TR not clampled", default_value=(0.75, 0.75), offset=(-15, -15),
+ color=[255, 255, 0, 255], clamped=False)
+ dpg.add_plot_annotation(label="TL", default_value=(0.25, 0.75), offset=(-15, -15), color=[255, 255, 0, 255])
+ dpg.add_plot_annotation(label="Center", default_value=(0.5, 0.5), color=[255, 255, 0, 255])
+
+dpg.create_viewport(title='Custom Title', width=800, height=600)
+dpg.setup_dearpygui()
+dpg.show_viewport()
+dpg.start_dearpygui()
+dpg.destroy_context()