Graph 减少gnuplot中轴上的标签数量

Graph 减少gnuplot中轴上的标签数量,graph,gnuplot,Graph,Gnuplot,我已经在gnuplot中生成了代码: set key box bottom right width 2 height 1 set format x "10^{%L}" set format y "10^{%L}" set xrange [10**(-4):10**12] set xtics 10**1 set yrange [10**8:10**31] set ytics 10**1 set ylabel 'Pressure erg cm^{-3}' fo

我已经在gnuplot中生成了代码:

set key box bottom right width 2 height 1
set format x "10^{%L}"
set format y "10^{%L}"
set xrange [10**(-4):10**12]
set xtics 10**1
set yrange [10**8:10**31]
set ytics 10**1
set ylabel 'Pressure erg cm^{-3}' font 'Times-Italic,14'
set xlabel 'Density g cm^{-3}' font 'Times-Italic,14'
set logscale x
set logscale y
plot '10.dat' u 1:2 with lines title 'T=1e10',\
     '9.dat' u 1:2 with lines title 'T=1e9',\
     '8.dat' u 1:2 with lines title 'T=1e8',\
     '7.dat' u 1:2 with lines title 'T=1e7',\
     '6.dat' u 1:2 with lines title 'T=1e6',\
     '5.dat' u 1:2 with lines title 'T=1e5'
要生成这样的图形:

但是,我想减少x轴和y轴上标签的数量,这样我就可以得到这样的东西:


有一些简单的方法可以做到这一点吗?

好吧,您明确地将tic距离设置为10。在gnuplot控制台中,键入帮助xtics。 请尝试以下操作:

set xrange [1e-4:1e12]
set xtics 1e-3, 100
set yrange [1e8:1e31]
set ytics 1e9, 1000
添加:

### "semi-automatic" tics
reset session

set xrange[1e-4:1e12]
set logscale x
set format x ""
set xtics 10

set yrange[1e8:1e31]
set logscale y
set format y ""
set ytics 10

do for [i=-3:12:2] {
    set xtics add (sprintf("10^{%d}",i) 10**i)
}
do for [i=9:30:3] {
    set ytics add (sprintf("10^{%d}",i) 10**i)
}

plot 1e12*x
### end of code
检查
帮助xtics
。您可以“半自动”放置tics

代码:

### "semi-automatic" tics
reset session

set xrange[1e-4:1e12]
set logscale x
set format x ""
set xtics 10

set yrange[1e8:1e31]
set logscale y
set format y ""
set ytics 10

do for [i=-3:12:2] {
    set xtics add (sprintf("10^{%d}",i) 10**i)
}
do for [i=9:30:3] {
    set ytics add (sprintf("10^{%d}",i) 10**i)
}

plot 1e12*x
### end of code
结果:

### "semi-automatic" tics
reset session

set xrange[1e-4:1e12]
set logscale x
set format x ""
set xtics 10

set yrange[1e8:1e31]
set logscale y
set format y ""
set ytics 10

do for [i=-3:12:2] {
    set xtics add (sprintf("10^{%d}",i) 10**i)
}
do for [i=9:30:3] {
    set ytics add (sprintf("10^{%d}",i) 10**i)
}

plot 1e12*x
### end of code

我知道它是这样工作的,但这不是我想要实现的。我想要与原始图表中相同的刻度数,但只是为了减少标签的数量。好的,现在它变得更清晰了。您希望减少tic标签的数量,但同时保留所有主要tic和次要tic。通常,每个主要议会都有一个标签。当然,有一个解决办法。等一下,非常感谢你的帮助和时间!