-
Notifications
You must be signed in to change notification settings - Fork 1
/
add_2d_histogram_series.col_major.py
38 lines (30 loc) · 1.58 KB
/
add_2d_histogram_series.col_major.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/local/bin/python3
import random
import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.create_viewport(title=f"Test - {dpg.get_dearpygui_version()}", width=500, height=750)
with dpg.window() as wnd:
dpg.set_primary_window(dpg.last_item(), True)
count_2d_histogram = 50000
xybin_2d_histogram = [100, 100]
x_dist = [random.gauss(1, 2) for _ in range(count_2d_histogram)]
y_dist = [random.uniform(1, 2) for _ in range(count_2d_histogram)]
with dpg.plot(label="Regular plot", width=-1, height=350, tag="plot"):
x_axis = dpg.add_plot_axis(dpg.mvXAxis, label="x")
with dpg.plot_axis(dpg.mvYAxis, label="y") as y_axis:
dpg.add_2d_histogram_series(x_dist, y_dist, tag="histogram_2d_series",
label="histogram", xbins=xybin_2d_histogram[0], ybins=xybin_2d_histogram[1],
xmax_range=6, xmin_range=-6, ymin_range=0, ymax_range=0
)
with dpg.plot(label="Regular plot", width=-1, height=350, tag="plot2"):
x_axis = dpg.add_plot_axis(dpg.mvXAxis, label="x")
with dpg.plot_axis(dpg.mvYAxis, label="y") as y_axis:
dpg.add_2d_histogram_series(x_dist, y_dist, tag="histogram_2d_series2", col_major=True,
label="histogram", xbins=xybin_2d_histogram[0], ybins=xybin_2d_histogram[1],
xmax_range=6, xmin_range=-6, ymin_range=0, ymax_range=0
)
dpg.setup_dearpygui()
dpg.show_viewport()
# dpg.show_style_editor()
dpg.start_dearpygui()
dpg.destroy_context()