MathGroup Archive 2007

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

Search the Archive

Plotting Points with Labels


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


  • Prev by Date: Re: RandomChoice does not accept null weights
  • Next by Date: RandomChoice does not accept null weights
  • Previous by thread: Re: RandomChoice does not accept null weights
  • Next by thread: Re: Plotting Points with Labels