Nathan Free
Nathan Free

Reputation: 33

Gnuplot: Defining an x axis based on the order of my values

I have some data

20,10.00
21,10.00
22,10.00
23,09.00
00,10.00
01,10.00
...

I want to graph the first value on the x axis and the second value on the y axis. I want the y axis to be autoset but I want the x axis to follow in line with my data eg. 20, 21, ..., 0, 1... instead of 0, 1, ..., 23

I thought I would do this with xticlabels, stating plot "filename" using xticlabels(1):2 or, as inspired by this, 1:2:xticlabels(1). Neither has the desired effect. What am I to do?

Upvotes: 1

Views: 247

Answers (2)

Christoph
Christoph

Reputation: 48420

Yes, you must use xticlabels to add individual labels. But now you must still specify some value for the x-axis. If you know, that the rows all have the same spacing, then use the zeroth column as x-value:

plot "filename" using 0:2:xticlabels(1)

Upvotes: 1

Nathan Free
Nathan Free

Reputation: 33

For my specific case, setting xrange [23:0] will suffice. However, this is not dynamic as it does not apply in the case of unordered values, so I am still curious of how the problem would otherwise be solved.

Upvotes: 0

Related Questions