Colormap for LineCollection

I would like to plot a set of lines where the color of each line is
parametrized. Then I want to add a colorbar to the plot.

For example, suppose I plot y=x+b for various values of b. For each
line, I would like to set the color to a particular value of b. When
plotting, all b values are normalized and applied to a colormap. The
colormap will show all colors...

I can create a LineCollection containing all my lines...but I must
specify the colors as RGB tuples....and I haven't figured out how to
add a colorbar such that the scale on the colorbar will match the
parametrized b values.

Ideas?

Tom,

Have you looked at line_collection2.py in the examples directory of the distribution (or svn)? I think it illustrates what you want to do.

Eric

Tom Johnson wrote:

ยทยทยท

I would like to plot a set of lines where the color of each line is
parametrized. Then I want to add a colorbar to the plot.

For example, suppose I plot y=x+b for various values of b. For each
line, I would like to set the color to a particular value of b. When
plotting, all b values are normalized and applied to a colormap. The
colormap will show all colors...

I can create a LineCollection containing all my lines...but I must
specify the colors as RGB tuples....and I haven't figured out how to
add a colorbar such that the scale on the colorbar will match the
parametrized b values.

Ideas?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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