hi all, i am trying to share both an axis label (but not the entire axis) and a figure legend across a set of subplots. that is, i'd like to have a figure where there is a major enlarged ylabel that is meant to label the entire row of subplots and a main figure legend, rather than individual legends inside subplots. what i have right now is:
import matplotlib.pyplot as plt from mpl_toolkits.axes_grid.axislines import SubplotZero fig = plt.figure() ax = SubplotZero(fig, 3, 1, 1) ax1 = fig.add_subplot(ax) ax.axis["xzero"].set_visible(True) plt.plot([1,2,3], label="line a", c='r') plt.plot([1.2, 2.4, 3.01], label="line b", c='b') ax = SubplotZero(fig, 3, 1, 2) ax2 = fig.add_subplot(ax) plt.plot([1,2,3], label="line a", c='r') plt.plot([1.2, 2.4, 3.01], label="line b", c='b') ax = SubplotZero(fig, 3, 1, 3) ax3 = fig.add_subplot(ax) plt.plot([1,2,3], label="line a", c='r') plt.plot([1.2, 2.01, 3.01], label="line b", c='b') plt.figlegend([ax1.lines[0], ax1.lines[1]], ["line a", "line b"], 'upper right') two quick questions about this: first, how can i create a single ylabel for the figure? i still want each subplot to have its own yticks and ytick labels but i just want a main label, since the quantity plotted on each y axis is the same. finally, plt.figlegend does display a main legend for the figure, like i intended, but i was hoping someone can explain how ax1.lines gets set. i was expecting ax1.lines to have 2 elements in it, one for each line plotted, but it has 4. why is that? right now i simply used lines[0] and lines[1] to create the labels for only the plotted lines... is there a better way of doing this? thanks. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users