Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
611 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 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...