DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

Remove the space between subplots

Open dearxxj opened this issue 6 months ago • 2 comments

Hi, is there a way to remove the space between subplots? I already removed the title, tick marks, tick labels in the subplots() or plot(). But there is still a border or spacing between the two subplots.

Image

BTW, thanks for developing such a fantastic library!

dearxxj avatar Jul 12 '25 01:07 dearxxj

Hi @dearxxj - try to reduce PlotPadding - you'll need to bind a theme to the subplots widget (remember to specify mvThemeCat_Plots as the category on theme styles).

You can actually test it in the demo - navigate to Plots - Subplots - Basic, then open Style Editor (Tools - Show Style Editor) and scroll down to the Plot Padding section. You'll see PlotPadding there as well as some other paddings used by plots.

v-ein avatar Jul 12 '25 06:07 v-ein

Thanks v! Somehow I got it working by binding the theme to the parent window rather than the subplot.

   with dpg.window(label="Main", tag="primary_window") as window_id:
          ........
            
           with dpg.subplots(rows=3, columns=1, height=-1, width=-1, link_columns=True, 
                              no_title=True, no_resize=True, track_offset=0, share_series=True) as subplots_id:
                pass

   with dpg.theme() as container_theme:
            with dpg.theme_component(dpg.mvPlot):
                    dpg.add_theme_style(dpg.mvPlotStyleVar_PlotBorderSize, 0, category=dpg.mvThemeCat_Plots)
                    dpg.add_theme_style(dpg.mvPlotStyleVar_PlotPadding, 0, 0, category=dpg.mvThemeCat_Plots)

   dpg.bind_item_theme(subplots_id, container_theme)  <== not working
   dpg.bind_item_theme(window_id, container_theme)    <== working

dearxxj avatar Jul 12 '25 08:07 dearxxj