如何调整gnuplot中的matics-number? [英] How to tweak automatic-tics-number in gnuplot?

查看:70
本文介绍了如何调整gnuplot中的matics-number?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

gnuplot自动选择合理的x/y范围和x/y-tic数(如附图中的大约5)是很有帮助的.

It is helpful that gnuplot automatically picks up reasonably good x/y-range, and x/y-tics number (say approx 5 as attached figure).

但是,有时候我想增加/减少抽烟次数.

However, I sometimes would like to increase/decrease the number of tics.

当然,更改抽签的数量很容易.我想做的是利用gnuplot自动抽动选择"的优势,但是调整抽动的数量.有什么办法可以解决这个问题?

Of course, changing number of tics is easy. The thing I would like to do is, to take the advantage of this gnuplot "automatic tics selecting", but tweaking the approx number of tics. Is there any way to deal with this?

谢谢!

推荐答案

好的,现在我明白了.特别是在多作图中,或者当图形相对于tic标签的大小变小时,tic太多了. 在下面找到一种变通方法,该变通方法似乎在演示的案例中有效.如果它一直都能正常工作,则需要进行测试.缺点是您必须先绘制到一个虚拟表,才能得到gnuplot关于gnuplot放入GPVAL_...变量中的最小和最大抽动的建议,然后再次重新绘制.

OK, now I see your point. Especially in multiplots or when the graphs are getting small relative to the size of the tic labels there are too many tics. Find below a workaround which seems to work in the demonstrated cases. If it works nicely all the time you need to test. The disadvantage is that you have to plot first to a dummy table in order to get gnuplot's suggestion about the minimum and maximum tics which gnuplot puts into the GPVAL_... variables and then replot again.

在下面的图形中,第一行是gnuplot auto-tic,第二行是半自动近似尝试.也许这是进一步调整的起点.

In the graph below the first row is gnuplot auto-tic, the second row the attempt for semi-auto-approximate-tic. Maybe it is a starting point for further tweaking.

### semi-automatic tics
reset session

Round(n) = gprintf("%.0e",n)
# or alternatively with less approximate tics: 
# Round(n) = gprintf("%.0e",n) + sgn(n)*10**gprintf("%T",n)
SemiAutoTicX(ApproxTicN) = Round((GPVAL_X_MAX - GPVAL_X_MIN)/ApproxTicN)
SemiAutoTicY(ApproxTicN) = Round((GPVAL_Y_MAX - GPVAL_Y_MIN)/ApproxTicN)

set multiplot layout 2,3 rowsfirst

### with gnuplot auto-tic
set xrange [-10:10]
plot x

set xrange [-100:100]
plot x**2

set xrange [-90:90]
plot x

### now with semi-auto tics
set style line 1 lc rgb "red"
set xrange [-10:10]
set table $Dummy
    plot x ls 1
unset table
set xtics SemiAutoTicX(5)
set ytics SemiAutoTicY(5)
replot

set xrange [-100:100]
set table $Dummy
    plot x**2 ls 1
unset table
set xtics SemiAutoTicX(5)
set ytics SemiAutoTicY(5)
replot

set xrange [-90:90]
set table $Dummy
    plot x ls 1
unset table
set xtics SemiAutoTicX(5)
set ytics SemiAutoTicY(5)
replot

unset multiplot

这篇关于如何调整gnuplot中的matics-number?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆