How to place text above hatched zone using matplotlib?
An example is shown below.
Below are my sample code for easy understanding
from pylab import *
fig=figure()
x=array([0,1])
yc=array([0.55,0.48])
yhc=array([0.55,0.68])
yagg=array([0.45,0.48])
plot(x,yc,'k-',linewidth=1.5)
plot(x,yhc,'k-',linewidth=1.5)
plot(x,yagg,'k-',linewidth=1.5)
xticks(fontsize = 22)
yticks(fontsize = 22)
ylim(0,1)
ax=axes()
p=fill_between(x, yc, yhc,color="none")
from matplotlib.patches import PathPatch
for path in p.get_paths():
p1 = PathPatch(path, fc="none", hatch="/")
ax.add_patch(p1)
p1.set_zorder(p.get_zorder()-0.1)
props = dict(boxstyle='round',facecolor='white', alpha=1,frameon='false')
text(0.6, 0.55, 'hi',fontsize=22)
fig.savefig('vp.png', transparent=True,bbox_inches='tight')
The hatched zone really makes it hard to see the text.