@@ -57,6 +57,12 @@ class SizeBarMixin(LegendPlot):
5757
5858 The sizebar_alpha is only used if sizebar is True.""" )
5959
60+ sizebar_bounds = param .NumericTuple (default = None , length = 2 , doc = """
61+ Bounds of the sizebar, default to None which will automatically
62+ determine the bounds based on the data.
63+
64+ The sizebar_bounds is only used if sizebar is True.""" )
65+
6066 sizebar_opts = param .Dict (
6167 default = {}, doc = """
6268 Allows setting specific styling options for the sizebar.
@@ -91,7 +97,16 @@ def _draw_sizebar(self, plot, renderer, glyph):
9197 orientation = self .sizebar_orientation ,
9298 glyph_fill_color = self .sizebar_color ,
9399 glyph_fill_alpha = self .sizebar_alpha ,
100+ bounds = self .sizebar_bounds or "auto" ,
94101 )
102+
103+ if "width" not in sizebar_kwargs : # Width is the primary axis
104+ match (self .sizebar_location , self .sizebar_orientation ):
105+ case ("above" | "below" , "horizontal" ):
106+ sizebar_kwargs ['width' ] = "max"
107+ case ("left" | "right" , "vertical" ):
108+ sizebar_kwargs ['width' ] = "max"
109+
95110 sizebar = SizeBar (** sizebar_kwargs )
96111 plot .add_layout (sizebar , self .sizebar_location )
97112 self .handles ['sizebar' ] = sizebar
0 commit comments