Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
591 views
in Technique[技术] by (71.8m points)

gnuplot - How to display tics only for the values in the dataset?

I have a standard dataset, say:

1,10
2,15
4,20
8,5

Is there any simple way to display tics only for the values in the dataset?

I can manually set them:

set xtics ( 1, 2, 4, 8 );
set ytics ( 5, 10, 15, 20 );

however, this has two side effects:

  1. I have to manually find all the values;
  2. for some reason, it removes the margines (compared to autoscaling), so I have to compute them manually (set offsets graph works strangely with tics manually set).

Is there any simple way of display the same plot it would be plotted without the set *tics command, with the only difference being the tics printed?

I'm on Gnuplot 5.2.

question from:https://stackoverflow.com/questions/65853860/how-to-display-tics-only-for-the-values-in-the-dataset

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can call xtic() and ytic() from the plot command. Eg:

set datafile separator comma
set offsets graph 0.1, graph 0.1, graph 0.1, graph 0.1
plot '-' using 1:2:xtic(1):ytic(2)  pt 7  lc black  title ""
1,10
2,15
4,20
8,5
end

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...