Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some chemical data that I am plotting using ListLogPlot.


ListLogPlot[data, Joined -> True]

enter image description here

I want to replace the x-axis tick values with the associated elements.

e.g. replace 1,2,3,...,14 with

xaxis= {"La","Ce","Pr","Nd","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu"};

Any suggestions on how to achieve this? Is there another plot function that I should be using?

share|improve this question
What's the deal with Europium? – wxffles Sep 5 '13 at 3:56
@wxffles Indeed, europium is anomalous :) – geordie Sep 5 '13 at 3:59
Nice plot, looks like an OIB REE pattern, I suppose you are working in geology/mineralogy? – Mockup Dungeon Sep 5 '13 at 8:22
@MockupDungeon Actually they are 1.7 - 1.6 Ga granitoids from the Mount Isa inlier, Australia. The samples with the strong negative Eu anomalies are incompatible element enriched granites and the other sample is a pegmatite that may have formed as a partial melt from one of these granites. – geordie Sep 5 '13 at 11:56
OK, thanks for the details. Pegmatites, yeah, I worked on them as well, from Ikaria, Greece. Li,Be,B-contents. – Mockup Dungeon Sep 6 '13 at 9:40
up vote 9 down vote accepted

I personally would also try to style this to see everything better - something like this:

ListLogPlot[data, Joined -> True, 
  Ticks -> {Transpose[{Range[14], xaxis}], Automatic}, 
  PlotStyle -> Thick, GridLines -> {Range[14], Automatic}, 
  GridLinesStyle -> Opacity[.5], Mesh -> All, 
  MeshStyle -> Directive[PointSize[.015], Opacity[.5]]] // Magnify

enter image description here

share|improve this answer
Many thanks! Yes, the GridLines make it easier to read. Good to know about Magnify as well. – geordie Sep 5 '13 at 3:46
@geordie One might use MapIndexed to avoid the hard-coded 14: Ticks -> {MapIndexed[{#2[[1]], #} &, xaxis], Automatic} – Mr.Wizard Sep 5 '13 at 9:06
@Mr.Wizard thanks for the suggestion. I ended up using Ticks -> {Transpose[{Range@Length@xaxis, xaxis}], Automatic}. This seems to do pretty much the same thing. Although it is not quite as elegant, it is almost twice as fast according to AbsoluteTiming. – geordie Sep 5 '13 at 11:50
@geordie I use that form a lot myself; it is particularly superior on packed arrays. However, in this case the speed shouldn't matter; you're not going to have a million tick labels. – Mr.Wizard Sep 5 '13 at 11:57

Your Answer


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.