Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I would like to make a scatter plot where each element corresponds to a certain energy. Each plot marker should have its corresponding element next to it. IE. The data point at -1.16187 should have "Sc" next to it. How can this be done?

data = {-1.16187, -1.48643, -3.31205, -0.541609, -4.18021, -4.79914,
   -4.3378, -3.10561, -0.968065, -1.1105, -8.40646, 0, -1.61386,
   -1.12215, -1.55604, -1.40126, -1.23439, -1.01761, -1.31265, -1.63032,
   -1.4456, -0.944587, -1.45256, -1.49496, -1.38007, -1.12108, -1.04517};

elements = {"Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Y",
   "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Hf", "Ta", "W",
   "Re", "Os", "Ir", "Pt", "Au"};

p1 = ListPlot[{#} &@data, FillingStyle -> Thick,
  PlotMarkers -> {Automatic, Medium}]
share|improve this question
1  
ListPlot[{#} &@data, PlotMarkers -> {Automatic, Medium}, Epilog -> (Text[First@#, Rest@## + {0, .25}] & /@ (Transpose[{#, Range@Length@#, data}] &@elements))] –  belisarius Apr 7 at 6:56

3 Answers 3

up vote 1 down vote accepted
dataPlot = ListPlot[data, PlotStyle -> PointSize -> Large, AxesOrigin -> {0, -9}, PlotRange -> {Automatic, {-9, 1}}];
labels = MapThread[Text[#1, {#2, #3 + 0.3}] &, {elements, Range[Length@data], data}];
Show[dataPlot, Graphics[labels]]

should do the job.

share|improve this answer

With some decoration :

With[{coord = MapIndexed[{#2[[1]], #1} &, data]}, 
   Graphics[{MapThread[Style[Text[#1, #2 + If[OddQ[#2[[1]]], {0, 2}, {0, -2}]],
       Black, 18, Italic] &, {elements, coord}], PointSize[Large], Gray, 
         Line[{#, # + If[OddQ[#[[1]]], {0, 1.4}, {0, -1.4}]}] & /@ coord, 
           Blue, Point@coord}, Axes -> {None, True}, AxesOrigin -> {0, -9}, 
             ImageSize -> 500]]

enter image description here

share|improve this answer
ListPlot[Thread@Labeled[data, elements, Right], 
  Filling -> Axis, FillingStyle -> Thick, PlotMarkers -> {Automatic, Medium}]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.