 
 
 
 
 
 
Re: Colored ListPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg9017] Re: [mg8975] Colored ListPlot
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Wed, 8 Oct 1997 00:05:14 -0400
- Sender: owner-wri-mathgroup at wolfram.com
ami at gladstone.uoregon.edu (Adam Hardin Price)
[mg8975] Colored ListPlot
> If it is possible I would like to ListPlot["list"], where list of 
> points in the plane, but with the following quality.
> The points will be joined (easily done with PlotJoined-> True),  
and > they should have a color function assigned to them so that the  
> color of each joining line is determined in some way by the  
points > on the ends (or point on one end if it easier.)
Adam,
A simple way is to start from scratch
lst ={{0,1},{3,0},{5,1}};
Make a list of the pairs of end points of the segments
ends =Partition[lst,2,1]
	{{{0, 1}, {3, 0}}, {{3, 0}, {5, 1}}}
Define a style function
st[{{a_,b_},{c_,d_}}]:=
	Sequence[Hue[a/c], Thickness[(c-a)/(c+a)/20]]
Create the list of styled lines
{st[#],Line[#]}&/@ends
	{{Hue[0], Thickness[1/20], Line[{{0, 1}, {3, 0}}]},
  		{Hue[3/5], Thickness[1/80], Line[{{3, 0}, {5, 1}}]}}
Show this list (with axes)
Show[Graphics[%], Axes->True]
Allan Hayes
hay at haystack.demon.co.uk
http://www.haystack.demon.co.uk/training.html
voice:+44 (0)116 2714198
fax: +44 (0)116 2718642
Leicester,  UK

