Hi all,

I'm trying to generate graphs from my test results, with regions 
coloured with succeeded and failing tests. It nearly works, but I have 
the following problem. I am providing the data with fill_between, which 
returns PolyCollection objects which cannot be provided to a legend. So 
I use the "proxy artist" trick, as described here

http://matplotlib.sourceforge.net/users/legend_guide.html#plotting-guide-legend

The problem is that my legend then gets placed over the graph. As it has 
been generated from proxy artists, it presumably doesn't take account of 
the real artists when deciding where to place itself.

I tried plotting lines as well as filling regions (commented lines in 
the code below) which works for the legend placement but leaves an ugly 
red line inside the green region, where presumably it is trying to show 
me that it's plotted a line.

As I in general have no idea what the data will look like I believe I 
need to use the "best" placement for the legend, I cannot hardcode it.

Any advice greatly appreciated. I paste below exactly what my program 
does (this is autogenerated from my real program).

Regards,
Geoff Bache

#!/usr/bin/env python

import pylab

pylab.clf()
figure4 = pylab.figure(1)
figure4.set_figwidth(9.4488188976377945)
figure4.set_figheight(7.8740157480314963)
axessubplot4 = pylab.subplot(111)
text4 = pylab.title("Test results for Application: 'Application One'  
Version: 'version2'", fontsize=10, family='monospace')
#axessubplot4.plot([0, 1, 2, 3, 4, 5], [2, 2, 2, 8, 8, 15], 
color='#CEEFBD', linewidth=2, linestyle='-', label='Succeeded tests')
#axessubplot4.plot([1, 2, 3], [2, 4, 8], color='#FF3118', linewidth=2, 
linestyle='-', label='Failed tests')
#axessubplot4.plot([4, 5], [8, 18], color='#FF3118', linewidth=2, 
linestyle='-', label='Failed tests')
axessubplot4.fill_between([0, 1, 2, 3, 4, 5], [0, 0, 0, 0, 0, 0], [2, 2, 
2, 8, 8, 15], color='#CEEFBD', linewidth=2, linestyle='-')
axessubplot4.fill_between([1, 2, 3], [2, 2, 8], [2, 4, 8], 
color='#FF3118', linewidth=2, linestyle='-')
axessubplot4.fill_between([4, 5], [8, 15], [8, 18], color='#FF3118', 
linewidth=2, linestyle='-')
pylab.xticks([0, 1, 2, 3, 4, 5], ['14Jan2006', '15Jan2006', '16Jan2006', 
'17Jan2006', '18Jan2006', '19Jan2006'])
silent_list8 = axessubplot4.get_xticklabels()
pylab.setp(silent_list8, 'rotation', 90, fontsize=7)
p = pylab.Rectangle((0, 0), 1, 1, fc="#FF3118")
p2 = pylab.Rectangle((0, 0), 1, 1, fc="#CEEFBD")
legend4 = axessubplot4.legend([ p, p2 ], ('Failed tests', 'Succeeded 
tests'), 'best', shadow=False)
fancybboxpatch4 = legend4.get_frame()
fancybboxpatch4.set_alpha(0.5)
figure4.subplots_adjust(bottom=0.25)
figure4.savefig('results.app1.version2.png', dpi=100)


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to