On Mon, May 17, 2010 at 10:08 AM, hettling <hettl...@few.vu.nl> wrote: > Dear all, > > I'm struggling with the following problem plotting my data: > > I have a figure with two panels next to each other, which I want to > label 'A' and 'B'. I want to left-justify my panel labels, but not to > the box that contains the plot, but to the y-axis label. I played around > with 'text()' and 'title()', but did not find a good solution except for > giving the coordinates manually to 'text()'. This would be very > inconvenient though, because I have many different plots on different > scales. > Here is what I tried: > > ###Code > import scipy > import matplotlib.pyplot as plt > > fig = plt.figure() > ax = fig.add_subplot(121) > plt.plot(scipy.sin(scipy.arange(1,100, 0.001))) > plt.xlabel('xlabel') > plt.ylabel("ylabel") > plt.text(0,1,"A", fontsize=14, transform=ax.transAxes) > > ax = fig.add_subplot(122) > plt.plot(scipy.cos(scipy.arange(1,100, 0.001))) > plt.text(0,1,"B", fontsize=14, transform=ax.transAxes) > plt.xlabel('xlabel') > ###End Code > > So the texts 'A' and 'B' should be a little bit higher and more to the > left. The 'A' I want to align with the y-axis label of the left plot, > the 'B' with the values of the y-axis of the right plot.
I haven't thought through the solution completely, but my intuition says that this might be helpful: http://matplotlib.sourceforge.net/examples/pylab_examples/anchored_artists.html http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#anchoredartists These examples show ways of anchoring artists (like Text) to certain locations. It's probably your best bet for getting what you want. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ------------------------------------------------------------------------------ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users