如何从gnuplot中的gnuplot y tics中删除尾随零?

问题描述 投票:0回答:2

我想在轴y上使用tics 1010.10.010.0010.00010.00001(没有尾随零)应用对数刻度。您能否请求我帮助我如何为我的GNUplot脚本提供这种格式?

gnuplot axis-labels
2个回答
0
投票

使用xticsytics等格式化,您可以在轴上添加或替换任何刻度标签。

set logscale y
set format y '%g'
set ytics add ('.00001' 0.00001, '.0001' 0.0001, '.001' 0.001, '.01' 0.01, '.1' 0.1)

0
投票

除了@Michael O.的解决方案之外的另一种解决方案:

### custom tics
reset session

set logscale y
set ytics nomirror
do for [n in "-10 -9 -8 -7 -6 -5 -4 -3 -2 -1"] {
    set ytics add (".0000000000"[1:abs(n)]."1" 10**n)
}

set logscale y2
set format y2 "10^{%T}"
set y2tics 10 nomirror

set xrange[-10:3]
plot 10**x axis x1y1, 10**x axis x1y2
### end of code

顺便说一句,如果你想要节省空间,你想摆脱领先的零,格式10^{%T}将更节省空间(见右轴)。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.