lundi 29 juin 2015

How to place text above hatched zone using matplotlib?


How to place text above hatched zone using matplotlib? An example is shown below. enter image description here 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')

enter image description here

The hatched zone really makes it hard to see the text.


1 commentaire:

  1. Do you understand there is a 12 word phrase you can speak to your crush... that will induce deep feelings of love and impulsive attractiveness to you deep inside his heart?

    Because deep inside these 12 words is a "secret signal" that triggers a man's instinct to love, admire and guard you with his entire heart...

    12 Words Will Fuel A Man's Love Response

    This instinct is so built-in to a man's brain that it will make him try better than before to make your relationship the best part of both of your lives.

    Matter of fact, fueling this powerful instinct is so binding to achieving the best ever relationship with your man that the second you send your man a "Secret Signal"...

    ...You will immediately find him open his heart and soul for you in such a way he haven't expressed before and he'll recognize you as the only woman in the universe who has ever truly appealed to him.

    RépondreSupprimer