MathGroup Archive 2008

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

Search the Archive

Re: Listplot with colours

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90846] Re: Listplot with colours
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sat, 26 Jul 2008 04:21:00 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <g4klhn$m8u$1@smc.vnet.net> <200807050849.EAA16716@smc.vnet.net> <g6c992$btq$1@smc.vnet.net>

King, Peter R wrote:

> I cannot find this in the help at all, although I am sure it is 
> straightforward.
> 
> I have a list of coordinates of points points={{x1,y1},{x2,y2}...}
> and two lists of attributes att1={a1,a2,..} and att2={b1,b2,...}
> 
> I want to do something like 
> ListPlot[points,PlotStyle->{Hue[att1],PointSize[att2]}]
> So I get dots at each point in colour att1 and size given by att2. I'm 
> sure it's easy but I can't do it. I am using version 5.1

The code below should work with version prior to 6.0, though you may 
have to add some Evaluate[] for the handling of arguments may have 
change between version 5.x and 6.x.

     points = {{0, 3}, {4, 1}, {5, 3}, {8, 1}, {2, 3}};
     att1 = {0.878824, 0.313478, 0.264895, 0.535987, 0.619636};
     att2 = {0.05, 0.1, 0.15, 0.2, 0.25};

     ListPlot[List /@ points, PlotStyle ->
          MapThread[{Hue[#1], PointSize[#2]} & , {att1, att2}]]

Regards,
-- Jean-Marc


  • Prev by Date: Re: Unprotect[Pi]
  • Next by Date: Re: Is this a bug?
  • Previous by thread: Listplot with colours
  • Next by thread: Re: lie symmetry package