如何从 gnuplot 中的 gnuplot y 抽动中删除尾随零?
How to remove trailing zeros from gnuplot y tics in gnuplot?
我想在 y 轴上应用一个对数刻度,带有抽搐 10
、1
、0.1
、0.01
、0.001
、0.0001
和 0.00001
(没有尾随零)。你能帮我看看如何为我的 GNUplot 脚本提供这种格式吗?
使用 xtics
、ytics
等格式,您可以在其中添加或替换轴上的任何刻度标签。
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)
除了@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
顺便说一下,以防万一你只是因为保存 space 而想去掉前导零,格式 10^{%T}
会更节省 space(见右图)轴)。
我想在 y 轴上应用一个对数刻度,带有抽搐 10
、1
、0.1
、0.01
、0.001
、0.0001
和 0.00001
(没有尾随零)。你能帮我看看如何为我的 GNUplot 脚本提供这种格式吗?
使用 xtics
、ytics
等格式,您可以在其中添加或替换轴上的任何刻度标签。
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)
除了@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
顺便说一下,以防万一你只是因为保存 space 而想去掉前导零,格式 10^{%T}
会更节省 space(见右图)轴)。