@@ -67,6 +67,7 @@ class AnchoredSizeBar(AnchoredOffsetbox):
6767 def __init__ (self , transform , size , label , loc ,
6868 pad = 0.1 , borderpad = 0.1 , sep = 2 , prop = None ,
6969 frameon = True , size_vertical = 0 , color = 'black' ,
70+ label_top = False ,
7071 ** kwargs ):
7172 """
7273 Draw a horizontal bar with the size in data coordinate of the give axes.
@@ -91,6 +92,8 @@ def __init__(self, transform, size, label, loc,
9192 vertical length of the size bar, given in data coordinates
9293 color : str, optional
9394 color for the size bar and label
95+ label_top : bool, optional
96+ if true, the label will be over the rectangle
9497
9598 Example:
9699 --------
@@ -110,7 +113,12 @@ def __init__(self, transform, size, label, loc,
110113
111114 self .txt_label = TextArea (label , minimumdescent = False )
112115
113- self ._box = VPacker (children = [self .size_bar , self .txt_label ],
116+ if label_top :
117+ _box_children = [self .txt_label , self .size_bar ]
118+ else :
119+ _box_children = [self .size_bar , self .txt_label ]
120+
121+ self ._box = VPacker (children = _box_children ,
114122 align = "center" ,
115123 pad = 0 , sep = sep )
116124
0 commit comments