Re: ? scatterplots with differently sized labels and dots ?
- To: mathgroup at smc.vnet.net
- Subject: [mg15541] Re: ? scatterplots with differently sized labels and dots ?
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Tue, 26 Jan 1999 13:44:29 -0500 (EST)
- Organization: University of Western Australia
- References: <77v2qm$kl4@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Nicholas Gessler wrote: > 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? Perhaps the following solution is easier than using Basic or C You have already used ReadList to import the data. Assuming that you put the data into a matrix, In[1]:= mat = {{1, 120, 55, 77}, {2, 50, 49, 63}, {3, 215, 44, 55}, {4, 10, 65, 44}}; Then use pattern-matching (easy to code, use, and modify) to do what you want: In[2]:= mat /. {m_Integer, w_, n_, e_} :> {AbsolutePointSize[w/5], Point[{e,n}],Hue[1],Text[m,{e,n}]}; Display the graphic: In[3]:= Show[Graphics[%], AspectRatio -> Automatic, Frame -> True]; Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul at physics.uwa.edu.au AUSTRALIA http://www.physics.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________