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
Not sure how to do a PR with the auto-generator, so I thought i would leave this here.
Minimal example:
fromimgui_bundleimportimgui, immapp, implotimportnumpyasnpdefgui():
imgui.text("Hello, heatmap!")
x=np.linspace(-4,4, 401)
xx=np.outer(x,x)
yy=np.sinc(xx)
rows,cols=yy.shapen_ticks=5x_ticks=y_ticks=[str(x) forxinnp.linspace(-4,4,n_ticks)]
axis_flags=implot.AxisFlags_.lock|implot.AxisFlags_.no_grid_lines|implot.AxisFlags_.no_tick_markscmap=implot.Colormap_.viridisimplot.push_colormap(cmap)
imgui.begin_group()
ifimplot.begin_plot("Sinc Function",[imgui.get_content_region_avail().x-70,-1],implot.Flags_.no_legend|implot.Flags_.no_mouse_text):
implot.setup_axes(None,None, axis_flags, axis_flags)
implot.setup_axis_ticks(implot.ImAxis_.x1,0,1,n_ticks,x_ticks,False)
implot.setup_axis_ticks(implot.ImAxis_.y1,0,1,n_ticks,y_ticks,False)
implot.plot_heatmap("##heatmap", yy, rows, cols, yy.min(), yy.max(), None, [0,1],[1,0],0)
implot.end_plot()
imgui.end_group()
imgui.same_line()
implot.colormap_scale("##heatmap_scale",yy.min(),yy.max(),imgui.ImVec2(60,-1),"%g", 0,cmap)
implot.pop_colormap()
immapp.run(
gui_function=gui, # The Gui function to runwindow_title="Hello Heatmap", # the window titlewindow_size_auto=True, # Auto size the application window given its widgets# Uncomment the next line to restore window position and size from previous run# window_restore_previous_geometry==Truewith_implot=True
)
FYI, I had to do some adaptations, here is a summary:
e2d69aa demo_heatmap python / use dpi independent sizing 0002a33: rows and cols deduced from py array (i.e do not require those in the python bindings) 5be6292: add stubs (i.e. python signatures, to enable IDE autocomplete)
Not sure how to do a PR with the auto-generator, so I thought i would leave this here.
Minimal example:
And the bindings:
~Nick
The text was updated successfully, but these errors were encountered: