Hi all,
I am creating what I would call a simple plot and up until now i have had no complaints. What I need is the ability to place a realtively small horizontal rectangle on the x-axis having never previously used the patches lib's. 8 hours and a slight sense of humour faliure later I am here. I have tried a number of methods now so i am convinced that there is a problem with my matplotlib setup or I am doing something incredably stupid, which I understand from previous experience is the more likely option
The problem is that I am also getting no output with simpler examples I am creating either. So the question is: I would like to add a simple rectangular box (12,0.01) on a plot similar to that shown below (I have used an example from ipython as I was trying to simplify things), so how would somebody else add a rectangular patch?
from pylab import *
from matplotlib.patches import Rectangle
a=load('NC_figure4.dat', skiprows=(1))
b=load('mean_NC_figure4.dat', skiprows=(1))
ax=a[:,0]
bx=b[:,0]
# ay1=N:C
ay1=a[:,1]
# ay2=average N:C
by1=b[:,1]
# by1=N:C
ay2=a[:,2]
# by2=average N:C
by2=b[:,2]
# cy=difference
cy=b[:,3]
xx1 = subplot(111)
t = arange(0.01, 10.0, 0.01)
scatter(ax, ay1, s=10, c='k', marker='o')
scatter(ax, ay2, s=10, c='b', marker='^')
plot (bx,by1,'k-',markersize=8)
plot (bx,by2,'b-',markersize=8)
plot (bx,cy,'r-',markersize=8)
xlim(-2,48)
ylim(0,0.22)
xlabel('Time [h]',fontsize=20)
ylabel('Elemental N:C [gN/gC]',fontsize=20)
text (32,0.06,'Dark treated',color='k',fontsize=20)
text (32,0.13,'Control',color='b',fontsize=20)
text (32,0.03,'Difference',color='r',fontsize=20)
Rectangle((12,0.01),12,0.01,fill=True, fc='k', visible=True)
show()