Hi,

I'm cross-posting a question I asked on SO:

   http://stackoverflow.com/q/15681890/152439

How can I vertically align text in matplotlib? My situation is as follows:

I'm using `ImageGrid`, to plot a row of five images:

    grid = ImageGrid(fig,
                     rect=(0.06, 0., 0.885, 1.),
                     nrows_ncols = (1, 5),
                     direction="row",
                     axes_pad = 0.,
                     add_all=True,
                     label_mode = "L",
                     share_all = True,
                     cbar_location="right",
                     cbar_mode="single",
                     cbar_size="10%",
                     cbar_pad="0%",
                    )

Within each axes, I want to add some text. For this, I defined the
following function (following one of the examples):

    def add_inner_title(ax, title, loc, props):
        from matplotlib.offsetbox import AnchoredText
        at = AnchoredText(title, loc=loc, prop=props,
                          pad=0., borderpad=0.5,
                          frameon=False)
        ax.add_artist(at)
        return at

which I use like this:

    ax = grid[i]
    tit = add_inner_title(ax, title, loc=3,
                          props={'size':'x-small',
                                 'color':'#b0b0b0',
                                 'weight' : 'bold',
                                 'va' : 'baseline'})

Now, in one of the plots, the axes, the title is "Pollution Signal", in
another, it is "one", and in another, it is "GOME" (all just examples).
The problem is that now the texts are not vertically aligned: The
baseline of the text with a *g* is higher to accomodate for the needed
space below the baseline.

How can I achieve that in my case, all texts are vertically aligned,
given that the heights of the individual text boxes are different?

Any help is greatly appreciated!
Andreas

------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to