MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Colored ListPlot

  • To: mathgroup at
  • Subject: [mg9017] Re: [mg8975] Colored ListPlot
  • From: Allan Hayes <hay at>
  • Date: Wed, 8 Oct 1997 00:05:14 -0400
  • Sender: owner-wri-mathgroup at

ami at (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.)

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

	Sequence[Hue[a/c], Thickness[(c-a)/(c+a)/20]]

Create the list of styled lines


	{{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
voice:+44 (0)116 2714198
fax: +44 (0)116 2718642
Leicester,  UK

  • Prev by Date: Re: TraceInternal and OptionQ
  • Next by Date: Re: Help! Integrate...
  • Previous by thread: Re: Colored ListPlot
  • Next by thread: Re: Colored ListPlot