Hi Eric!

Are you sure you want a colorbar with lines and not a legend?


Well, I've got a couple of lines (~50) and thus the legend would become
confusing.
I wanted to have lines in the colorbar because I think it's more adequate to
have lines in the bar when there are lines in the plot.

A colorbar with lines only, matching a LineCollection, can be done with
>  the facilities in mpl's colorbar.py module; you might take a look at
> the code in that module to see how it is being done in the line contour
> case. Note that ColorbarBase has a method, add_lines, for this. I'm
> sorry I don't have time to be more specific now, though.


Thanks for the hint! I was quite simple, I made a call to
pylab.colorbar(filled=False)
which gave me an empty colorbar. Then I add lines to this instance:
colorbar.ColorbarBase.add_lines(cbar, myrange, linecl.get_colors(),
linecl.get_linewidth())

Thanks! Bernhard



>
> Eric
>
> Bernhard Voigt wrote:
> > Dear all!
> >
> > I'm folowing the line_collection2.py example to create a LineCollection
> > plot with a colorbar.
> > How can I force the colorbar to show distinct lines like it does in
> > contour plots for a LineCollection plot?
> >
> > Thanks! Bernhard
>
-------------------------------------------------------------------------
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to