MathGroup Archive 1999

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

Search the Archive

Re: ? scatterplots with differently sized labels and dots ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15530] Re: [mg15482] ? scatterplots with differently sized labels and dots ?
  • From: BobHanlon at aol.com
  • Date: Mon, 18 Jan 1999 23:47:29 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 1/18/99 10:46:06 AM, gessler at ucla.edu writes:

>I have successfully used ReadList and ListPlot to read a table of data
>from  the hard drive and produce a simple scatterplot.  What I want to
>be able to do  is to label each point with a sequence number and vary
>the point size  according to a third variable.  
>
>Example:  I wish to plot an inventory of iron artifacts according to
>catalog  number, weight, easting and northing.  The table looks like
>this:
>
>number   weight   easting   northing 
>1          120      55        77 
>2           50      49        63 
>3          215      44        55 
>4           10      65        44
>
>I want the dot size to be proportional to the weight so the plot might
>look  like this:
>
>                                [[1]]
>                         (2)
>             (((3)))
>                                         [4]
>
>If I were writing a program in Basic, this would be simple enough.  Is
>there a  way to do this easily in Mathematica or should I write a
>program in C?
>

Nick,

This should be fairly close to what you want:

data = {{1, 120, 55, 77}, {2, 50, 49, 63},
	{3, 215, 44, 55}, {4, 10, 65, 44}}; transData = Transpose[data];
labels = Take[transData, 1][[1]];
wt = N[Sqrt[Take[transData, {2, 2}][[1]]]]; xyData =
Transpose[Take[transData, {3,4}]];

minWt = Min[wt]; maxWt = Max[wt];
minPt = 0.02; maxPt = 0.05;
ptSize = ((maxPt - minPt)*#/(maxWt - minWt) + 
	(minPt*maxWt - maxPt*minWt)/(maxWt - minWt))& /@ wt; modData =
Transpose[{labels, ptSize, xyData}];

TableForm[data, 
  TableHeadings -> {None, {"number", "weight", "easting", "northing"}}, 
TableAlignments -> Center]
ListPlot[xyData, ImageSize -> {360, 222}, 
	Frame -> True, Axes -> False,
	PlotRange -> {{43, 67}, {40, 80}}, 
	FrameLabel -> 
		{"easting", "northing\n", "Inventory", None}, 
	Epilog -> Evaluate[
			{Text[StyleForm[#[[1]], FontSize -> Floor[7+180*#[[2]]]], #[[3]], 
						{-2.25, 0}],  RGBColor[1, 0, 0], 
			PointSize[#[[2]]], Point[#[[3]]]}& /@ 
				modData]];

Bob Hanlon


  • Prev by Date: RE: Special characters
  • Next by Date: Re: Using Mathematica over Telnet
  • Previous by thread: ? scatterplots with differently sized labels and dots ?
  • Next by thread: RE: ? scatterplots with differently sized labels and dots ?