轴标记在Gnuplot中的命令不起作用?

时间:2014-03-13 18:41:24

标签: gnuplot

我有一个看起来不漂亮的多余情节,这应该是一篇物理论文。虽然我可以看到很多问题,但最令人沮丧的是,似乎Gnuplot完全违反了我在某些子图上设置的ytics命令。此外,第一个绘图的轴标签最终会在第二个绘图上结束。我如何解决这些Gnuplot有自己的想法并拒绝做我说的问题?

reset
set terminal postscript eps enhanced color size 10,5
set output 'C:\\Users\\cole1\\Desktop\\multiplot3.eps'
set multiplot
set xtics font "Times-Roman, 20"
set ytics font "Times-Roman, 18"

set size .5,.25
set origin 0,.75
set label "(a)" at screen .06,.95
plot 'C:\\Users\\cole1\\Documents\\MATLAB\\logefficiency1.txt' using 1:2 lc rgbcolor "#FF0000" pt 5 with lp notitle
set ytics -3,1,2
set xlabel "Log_{10} current density factor"
set ylabel "Log_{10} percent efficiency"
unset label 1


set size .5,.25
set origin .5,.75
set label "(b)" at screen .56,.95
plot 'C:\\Users\\cole1\\Documents\\MATLAB\\spectralinfo4009.txt' using 1:2 lc rgbcolor "#0000FF" with lines notitle
set ytics 0,0.5,1
set xlabel "Frequency(THz)"
set ylabel "Intensity/ freq. interval (arb.)"
unset label 1


set size .5,.25
set origin 0,.5
set label "(c)" at screen .06,.7
plot 'C:\\Users\\cole1\\Documents\\MATLAB\\spectralinfo4018.txt' using 1:2 lc rgbcolor "#0000FF" with lines notitle
set ytics 0,1,4
set xlabel "Frequency(THz)"
set ylabel "Intensity/ freq. interval (arb.)"
unset label 1


set size .5,.25
set origin .5,.5
set label "(d)" at screen .56,.7
plot 'C:\\Users\\cole1\\Documents\\MATLAB\\spectralinfo4027.txt' using 1:2 lc rgbcolor "#0000FF" with lines notitle
set ytics 0,15,60
set xlabel "Frequency(THz)"
set ylabel "Intensity/ freq. interval (arb.)"
unset label 1


set size .5,.25
set origin 0,.25
set label "(e)" at screen .06,.45
plot 'C:\\Users\\cole1\\Documents\\MATLAB\\spectralinfo4036.txt' using 1:2 lc rgbcolor "#0000FF" with lines notitle
set ytics 0,15,60
set xlabel "Frequency(THz)"
set ylabel "Intensity/ freq. interval (arb.)"
unset label 1


set size .5,.25
set origin .5,.25
set label "(f)" at screen .56,.45
plot 'C:\\Users\\cole1\\Documents\\MATLAB\\spectralinfo4045.txt' using 1:2 lc rgbcolor "#0000FF" with lines notitle
set ytics 0,15,60
set xlabel "Frequency(THz)"
set ylabel "Intensity/ freq. interval (arb.)"
unset label 1


set size .5,.25
set origin 0,0
set label "(g)" at screen .06,.2
plot 'C:\\Users\\cole1\\Documents\\MATLAB\\spectralinfo4054.txt' using 1:2 lc rgbcolor "#0000FF" with lines notitle
set ytics 0,30,120
set xlabel "Frequency(THz)"
set ylabel "Intensity/ freq. interval (arb.)"
unset label 1


set size .5,.25
set origin .5,0
set label "(h)" at screen .56,.2
plot 'C:\\Users\\cole1\\Documents\\MATLAB\\spectralinfo4063.txt' using 1:2 lc rgbcolor "#0000FF" with lines notitle
set ytics 0,300,1200
set xlabel "Frequency(THz)"
set ylabel "Intensity/ freq. interval (arb.)"
unset label 1


unset xtics
unset ytics
unset multiplot

1 个答案:

答案 0 :(得分:0)

ytic设置仅在放置在plot命令之前才有效。这适用于所有设置。必须在相应的plot命令之前完成必须出现在图表和所有设置中的所有内容:

set ytics 1
plot x

以下是您脚本的改进版本:

reset

datadir = 'C:\\Users\\cole1\\Documents\\MATLAB\\'

set terminal postscript eps enhanced color size 10,5
set output 'multiplot3.eps'

set xtics font "Times-Roman, 20"
set ytics font "Times-Roman, 18"

set style line 1 lc rgb "red" pt 5
set style line 2 lc rgb "blue"

set style data lines
unset key

set multiplot layout 4,2

set label 1 "(a)" at graph 0.01,0.9
set ytics 1
set xlabel "Log_{10} current density factor"
set ylabel "Log_{10} percent efficiency"
plot datadir.'logefficiency1.txt' ls 1 with lp

set label 1 "(b)"
set ytics 0.5
set xlabel "Frequency (THz)"
set ylabel "Intensity / freq. interval (arb.)"
plot datadir.'spectralinfo4009.txt' ls 2

set label 1 "(c)"
set ytics 1
plot datadir.'spectralinfo4018.txt' ls 2

set label 1 "(d)"
set ytics 15
plot datadir.'spectralinfo4027.txt' ls 2

set label 1 "(e)"
plot datadir.'spectralinfo4036.txt' ls 2

set label 1 "(f)"
plot datadir.'spectralinfo4045.txt' ls 2

set label 1 "(g)"
set ytics 30
plot datadir.'spectralinfo4054.txt' ls 2

set label 1 "(h)"
set ytics 300
plot datadir.'spectralinfo4063.txt' ls 2

unset multiplot

要点是:

  1. 使用set multiplot layout 4,2自动更改尺寸和原点。
  2. 如果他们不改变,您必须只设置一次xlabelylabel
  3. 同样,只有在设置更改时才必须使用set ytics
  4. 通常,如果启用了自动缩放,则不能指定ytics的开始和结束,而只能指定增量。
  5. 对于子图标签,使用相对于实际绘图的坐标(graph 0.01,0.9)。并始终使用相同的标签ID(1)。然后对于第二个和所有后续图表,您必须仅更改文本,使用旧坐标。然后,您只需在代码中的一个位置微调标签位置。
  6. 使用set style data lines
  7. 使用线条样式
  8. 使用unset key隐藏图例。