You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The API add_theme_color supports color dict as input, but it doesn't work.
Here is the code
import random
import dearpygui.dearpygui as dpg
dpg.create_context()
with dpg.theme() as plot_theme:
with dpg.theme_component(dpg.mvScatterSeries):
marker_size = dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 1, category=dpg.mvThemeCat_Plots)
color_dict = []
for i in range(10):
if i %2 == 1:
color_dict.append((255,0,0,255))
else:
color_dict.append((0,255,0,255))
dpg.add_theme_color(dpg.mvPlotCol_MarkerFill, value=color_dict, category=dpg.mvThemeCat_Plots)
def change_marker_size(_, app_data):
dpg.set_value(marker_size, [app_data])
with dpg.window():
dpg.add_slider_int(label="Marker Size", min_value=1, max_value=10, default_value=1, callback=change_marker_size)
with dpg.plot():
dpg.add_plot_legend()
dpg.add_plot_axis(dpg.mvXAxis)
with dpg.plot_axis(dpg.mvYAxis):
for _ in range(1):
x = [random.random() for _ in range(10)]
y = [random.random() for _ in range(10)]
dpg.add_scatter_series(x,y)
dpg.bind_item_theme(dpg.last_item(), plot_theme)
dpg.add_line_series(x,y)
dpg.create_viewport(width=600, height=500)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
And this is what I got:
The text was updated successfully, but these errors were encountered:
The API add_theme_color supports color dict as input
Hmm... why do you think it does?
Also, FWIW, color_dict in your code is a list, not a dict.
If you want to draw every marker with a different color, you can render them individually with draw_circle. Maybe there are other ways, it was just first to come to my mind.
Hello there
The API add_theme_color supports color dict as input, but it doesn't work.
Here is the code
And this is what I got:
The text was updated successfully, but these errors were encountered: