Description
Problem
Currently we can position text relative to a single artist, as described in https://matplotlib.org/stable/tutorials/text/annotations.html?highlight=complex%20coordinate#using-complex-coordinates-with-annotations.
I would like to position texts relative to multiple artists. For instance, let's consider two text artists, txt1
positioned at (0.5,0.25) and txt2
(.5,0.75). Assume they are left-aligned and of width 0.1, so the left edge of each of their bbox is at 0.5, the right edge is at 0.6, and assume that txt2
at (.5,0.75) is top-aligned, so the top of its bbox is 0.75, and txt1
is bottom-aligned, so the bottom of its bbox is 0.25.
I would like some function combine_artists(txt1,txt2)
that returns an object that combines the coordinate systems of txt1
and txt2
so that an artist can be positioned relative to the combined bbox. For instance, I would like to position some artist txt3
that is vertically centered between txt1
and txt2
. Its data coordinate is (0.5,0.5), but its relative position coordinate in the combined txt1+txt2
space would be (0,0.5).
Proposed solution
There may already be a way to do this in the library, as it seems transforms are addable. What remains then is making the interface to creating the combined bbox/transform in a way that is easily accessible. I already tried just adding the transforms of the txt1
and txt2
, which seemed like the most intuitive way for this to work.