|
From: Eric F. <ef...@ha...> - 2014-03-17 19:13:44
|
On 2014/03/17 3:31 AM, Florian M. Wagner wrote: > Dear users, > > I would like label my subplots with a horizontally left-aligned letter > (wanted by the journal) and the normal, centered axes title, which > should both be vertically in line. The following example does not work: > > from matplotlib import pyplot as plt > import numpy as np > > fig, ax1 = plt.subplots() > x = np.linspace(1,10) > y = (sin(x)) > ax1.plot(x,y) > > def subplot_label(ax, letter, title): > title = ax.set_title(title) > pos = title.get_position() > va = title.get_va() > ax.text(0, pos[1], letter, transform=ax.transAxes, > verticalalignment=va) > > subplot_label(ax1, 'a)', 'This text is not aligned with the label') > > > Which property of the axes title am I missing? Is the following what you need? http://matplotlib.org/examples/pylab_examples/titles_demo.html Eric > > Thank you for your help > |