Message Boards Message Boards

0
|
4086 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Graphics help

Posted 10 years ago

Hello

I need to labeling the points of my plot, could you help to fix my code please.

labels = {"2501", "2502", "2503", "2510", "2511", "2522", "2524", 
   "2528", "2539"};
data = {{0.1297, 0.1840}, {0.3612, 
    0.1240}, {-1.3952, -0.6757}, {-0.9369, 0.1543}, {-0.2940, 
    0.7242}, {-0.3331, -0.3813}, {0.1715, 
    0.4654}, {0.4932, -0.4044}, {0.5028, 0.2906}};
Show[
 ListPlot[points],
 Graphics[Text[#2, #1 + {0, 0.05}] & /@ {points, labels}]
 ]

Thank a lot

POSTED BY: Vinicio Sevilla
2 Replies

Here is a modification that works (note that I changed your argument to data from points):

Show[ListPlot[data], 
 Graphics[Text[#[[2]], #[[1]] + {0, 0.05}] & /@ 
   Transpose@{data, labels}]]

and here is a version without needing to use Show:

ListPlot[data, 
 Epilog -> (Text[#[[2]], #[[1]] + {0, 0.05}] & /@ 
    Transpose@{data, labels})]
POSTED BY: David Reiss

Thanks a lot David you save my day

Regards

Vinicio

POSTED BY: Vinicio Sevilla
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract