1import matplotlib.pyplot as plt 2from matplotlib_scalebar.scalebar import ScaleBar 3 4fig, ax = plt.subplots(figsize=(3, 2.8)) 5ax.axis("off") 6 7scalebar = ScaleBar( 8 1, 9 "cm", 10 length_fraction=0.75, 11 width_fraction=0.05, 12 scale_loc="bottom", 13 label="scale_loc=bottom", 14 location="upper center", 15 box_color="0.8", 16 pad=0.5, 17) 18ax.add_artist(scalebar) 19 20scalebar = ScaleBar( 21 1, 22 "cm", 23 length_fraction=0.75, 24 width_fraction=0.05, 25 scale_loc="right", 26 label="scale_loc=right", 27 location="center", 28 box_color="0.8", 29 pad=0.5, 30) 31ax.add_artist(scalebar) 32 33scalebar = ScaleBar( 34 1, 35 "cm", 36 length_fraction=0.75, 37 width_fraction=0.05, 38 scale_loc="top", 39 label="scale_loc=top", 40 location="lower center", 41 box_color="0.8", 42 pad=0.5, 43) 44ax.add_artist(scalebar) 45 46fig.savefig("argument_scale_loc.png", dpi=100, bbox_inches="tight") 47