Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1997
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

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

Search the Archive

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


  • 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