From: John H. <jdh...@ac...> - 2004-10-17 00:07:52
|
>>>>> "Dirk" == <rep...@we...> writes: Dirk> I cannot get that ylabel to write it's text on the Dirk> right-hand side of the graph. I use two scales following the Dirk> 'two_scales.py' examples from the matplotlib-src, but this Dirk> examples doesn't put ylabels. Dirk> Is there a way to get a ylabel on both sides? To make a ylabel on the right, use the text command. You need to set the transform to use axes coordinates (ax.transAxes), rotate the text vertically, make the horizontal alignment left, the vertical alignment centered. Note that x, y = 1, 0.5 is the right, middle of the axes in axes coordinates. You also need to turn off clipping, so the text can appear outside the axes w/o being clipped by the axes bounding box, which is the default behavior. from matplotlib.matlab import * plot([1,2,3]) text(1.02, 0.5, 'volts', horizontalalignment='left', verticalalignment='center', rotation='vertical', transform=gca().transAxes, clip_on=False) show() |