Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates > by-pkgid > dc303dcad9fdd039290b4e78a58ed938 > files > 713

python-matplotlib-0.99.1.2-4.fc13.i686.rpm

#!/usr/bin/python
#
# Show how to add a translucent legend

# import pyplot module
import matplotlib.pyplot as plt

# draw 2 crossing lines
plt.plot([0,1], label='going up')
plt.plot([1,0], label='going down')

# add the legend in the middle of the plot
leg = plt.legend(fancybox=True, loc='center')
# set the alpha value of the legend: it will be translucent
leg.get_frame().set_alpha(0.5)

# show the plot
plt.show()