1

I have a set of data, x is time(in second), y is height. y goes up and down, with some peaks (period varies). I am only interested in y around the peaks, so deleted other data. The remained x (time) value unchanged. I end up with x has value like 20, 21,..., 40, then jump over a large time frame e.g. 2000, continue with 2001, 2002,...,2050, then jump over another e.g.5000, continue with 5001, 5002, ..., 5030. the last x value is 60000 (for example).

If I still use plt.plot(x,y), the x axis is evenly spread out from 20 to 60000 (based on value of x). I need x axis to be evenly spread out based on how many data points in x. plt.plot(y) does that but doesn't mark the x's value on the x axis, which is essential for my plotting.

Zheng
  • 339
  • 2
  • 4
  • 11
  • This may help https://stackoverflow.com/questions/39540730/how-to-make-xticks-evenly-spaced-despite-their-value – kgf3JfUtW Dec 16 '17 at 03:05
  • Thanks Sam. that partially solved my problem. I didn't make it clear in the question. I don't need all the x's value marked on the x axis. but need what plt.plot (x,y) does, mark some x's values. for example, I have 6000 data points on x axis, I need the x's value marked on the x axis every 1000 data points. – Zheng Dec 16 '17 at 04:05
  • How would you determine which values to show on the x axis then? Maybe you want something like [a broken axis](https://matplotlib.org/examples/pylab_examples/broken_axis.html)? – ImportanceOfBeingErnest Dec 16 '17 at 08:11

0 Answers0