This is probably my lack of knowledge of python, but how do I set up
legend labels for some bar-plots that have been produced inside a
function. For example, the following will nicely plot my bar-plots, but
then legend doesn't know about the colours used, so here just uses black
for both labels. I'd like the labels to have the same colour as the bars
generated inside plotb. (I am using a function here as my real code has
extra stuff to calculate error-bars and suchlike for each data set.)
x=arange(0,5)
y=array([ 1.2, 3.4, 5.4, 2.3, 1.0])
z=array([ 2.2, 0.7, 0.4, 1.3, 1.2])
def plotb(x,y,col):
p=bar(x,y,color=col)
plotb(x,y,'k')
plotb(x+0.4,z,'y')
legend(('YYY,'ZZZ'))
I tried passing the object "p" through the plotb argument list, but
python didn't like that. (I am just learning python, and so far haven't
seen how to pass such objects around.
Thanks for any tips,
Dave
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users