Hi all,
i have a lot of label entrys, which i want to put above the figure. My
problem is, i use 2 yaxes so a simple axes([]) call isn`t working.
Plotting graphs with only one x and y axes, using i.e.
"axes([0.1,0.1,0.9,0.8)]" worked perfect. Printing the legends for the
plots is working too, but the legend is above the figure, see example
code below. So how do i shrink the figure size so the legend isn`t
overlapping the graphs?
### Example code ###
import numpy as np
import matplotlib.pylab as mpl
fig = mpl.figure()
ax1 = fig.add_subplot(111)
# Using axes won`t work here
# mpl.axes([0.1,0.1,0.9,0.7])
x = np.linspace(1,10,10)
y = np.linspace(1,10,10)
ax1.plot(x,y**2,'g-',label='y(x)=x**2')
ax1.legend(bbox_to_anchor=(0.,0.92,1.,.1),
loc=10,ncol=1,mode='expand',borderaxespad=0.)
ax2 = ax1.twinx()
ax2.plot(x,y,'b.',label='y(x)=x')
ax2.legend(bbox_to_anchor=(0.,1.,1.,.1),
loc=10,ncol=1,mode='expand',borderaxespad=0.)
mpl.show()
···
--
Answer: Because we read from top to bottom, left to right!
Question: Why should i start my reply below the quoted text?