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 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

1 Answer 1

up vote 7 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

 
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.