Plotting Points with Labels
- To: mathgroup at smc.vnet.net
- Subject: [mg83399] Plotting Points with Labels
- From: JOHN ERB <john_c_erb at prodigy.net>
- Date: Mon, 19 Nov 2007 06:19:11 -0500 (EST)
The code below plots "pntdata" labeling the points, where the data represents the x and y coordinates, and the value at that point {{x1,y1,value1}, ... , {xN,yN,valueN}}; The labels are shifted to the right (+x direction) of the respective points by the value of "shiftText." Is there a better (or more succinct) way of doing this? pntdata={{0,0,100.01},{2,2,350.4},{4,5,380.5}}; newdata=Map[({{#[[1]],#[[2]]},{Round[#[[3]]]}})&,pntdata]; shiftText=0.8; Graphics[{Red,PointSize[0.02], Map[{Point[#[[1]]],Style[Text[StringJoin["dose = ",ToString[#[[2,1]]]," cGy"], {#[[1,1]]+shiftText,#[[1,2]]}],Bold,12,Black]}&,newdata]},Frame->True] Thanks, John C. Erb
- Follow-Ups:
- Re: Plotting Points with Labels
- From: "W. Craig Carter" <ccarter@mit.edu>
- Re: Plotting Points with Labels