I am facing serious difficulties in placing a AnchoredSizeBar outside its given axes. From the AnchoredSizeBar reference, the loc attribute accepts only 'string' methods that are relative to the given axes used for the AnchoredSizeBar creation.
Therefore, if I wanted to set the AnchoredSizeBar position outside the given axes, the loc attribute wouldn't work. In fact, it would raise an error message.
Would someone knows a way to circumvent that problem?
If possible, I would like to create a AnchoredSizeBar, whose bar size is yet relative to a given axes in the figure, but the AnchoredSizeBar location can be placed anywhere inside the figure instance.
Here is a code snipped of what I would like:
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
fig, ax = plt.subplots(figsize=(3, 3))
x_position = 0.15
y_position = 0.35
Figure_location = (x_position, y_position) # figure xy locations relative to fig.transFigure.
axes_width_to_size_bar = 0.3
bar0 = AnchoredSizeBar(ax.transData, axes_width_to_size_bar, 'unfilled', loc=Figure_location, frameon=False, size_vertical=0.05, fill_bar=False)
ax.add_artist(bar0)
bar0_extent = bar0.get_extent()
fig.show()
I thank you for your time. Sincerely yours,
Philipe Riskalla Leal