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 data {x, y} where x starts at -25 degrees and goes up to +25 degrees in 1 degree steps, and then comes back down to -25 degrees in 1 degree steps again.

I want to plot this sinusoidal-type data without the y-data overlapping in the ranges -25 - +25 degrees. I have attached an image of the kind of graph I am after.

enter image description here

How does one do this?

share|improve this question
up vote 9 down vote accepted

You can always use Manual Tick specifications:

ticks = Join[Range[-25, 25, 5], Range[20, -25, -5]];
data = Table[{x, RandomInteger[10]}, {x, ticks}];

now the plot. the [[;; ;; 2]] selects just every second tickmark. Note that I plot the y-data just against their index and not against their x-value.

ListLinePlot[data[[All, 2]],  
  Ticks -> {Transpose[{Range@Length[data], ticks}][[;; ;; 2]], Automatic}]

enter image description here

share|improve this answer

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.