我有两个问题。
1)我试图为label
和key
设置不同的字体大小。对于下面的MWE,奇怪的是无法这样做,尽管从那里手册中语法似乎是正确的。
有没有明显的错误?
2)如何让Z轴在最右边的z列中标记其ztics。我没有成功使用z2tics完成它。
Gnuplot版本(在Ubuntu 10.04中):
G N U P L O T
Version 4.4 patchlevel 0
last modified March 2010
System: Linux 2.6.32-73-generic
Copyright (C) 1986-1993, 1998, 2004, 2007-2010
Thomas Williams, Colin Kelley and many others
MWE:
#!/usr/local/bin/gnuplot
reset
set term postscript eps enhanced font "Helvetica"10
set output "output.eps"
set autoscale
set grid nopolar
set grid xtics nomxtics ytics nomytics noztics nomztics nox2tics nomx2tics noy2tics nomy2tics nocbtics nomcbtics
set grid layerdefault lt 1 lc rgb "black" linewidth 0.200 , lt 2 lc rgb "black" linewidth 0.200
set style data lines
set xlabel "X-Axis" font 'Helvetica,25'
set xlabel offset character 3, -2, 0 font "" textcolor lt -1 rotate by -270
set xlabel font "" textcolor lt -1 norotate
set xrange [ 1 : 4 ] noreverse nowriteback
set xtics 1
set ylabel "Y-Axis" font 'Helvetica,25'
set ylabel offset character -3, -2, 0 font "" textcolor lt -1 norotate
set ylabel font "" textcolor lt -1 norotate
set yrange [ 1 : 4 ] noreverse nowriteback
set ytics 1
set zlabel "Z-Axis" font 'Helvetica,25'
set zlabel offset character 2, 0, 0 font "" textcolor lt -1 norotate
set zlabel font "" textcolor lt -1 rotate by 90
set zrange [ 0 : 16 ] noreverse nowriteback
set key top left horizontal box spacing 1.75 at 2.5,5,18
set dgrid3d 4,4 splines
splot \
"data.dat" using 2:1:3 ti "Surface 1" with lines lc rgb "red" ,\
"data.dat" using 2:1:4 ti "Surface 2" with lines lc rgb "blue"
数据文件(data.dat):
Column 1 Column 2 Column 3 Column 4
1 1 4.869679347 3.972865464
1 2 5.525583065 4.021323159
1 3 5.301208942 4.030586248
1 4 5.196368577 4.013930969
2 1 8.431558641 5.219640683
2 2 8.541050259 4.604480742
2 3 8.959566461 4.473923458
2 4 8.553504132 4.286745078
3 1 11.12925205 7.254675355
3 2 11.59059432 7.374715619
3 3 10.67896866 7.058545226
3 4 11.09279485 6.728441639
4 1 15.57308092 10.92185317
4 2 15.26268993 10.59114975
4 3 14.88192486 10.1134937
4 4 14.74660555 10.15774687
答案 0 :(得分:1)
为font
和xlabel
设置ylabel
后,您可以使用以下调用覆盖它两次,其中包含set xlabel font ""
之类的内容。合并这些主要是多余的电话:
#!/usr/local/bin/gnuplot
reset
set term postscript eps enhanced font "Helvetica,10" color
set output "output.eps"
set xlabel "X-Axis" font 'Helvetica,25' offset character 3, -2, 0
set xrange [ 1 : 4 ]
set xtics 1
set ylabel "Y-Axis" font 'Helvetica,25' offset character -3, -2, 0
set yrange [ 1 : 4 ]
set ytics 1
set zlabel "Z-Axis" font 'Helvetica,25' offset character 2, 0, 0
set zrange [ 0 : 16 ]
set key top left horizontal box spacing 1.75 at 2.5,5,18
set dgrid3d 4,4 splines
splot \
"data.dat" using 2:1:3 ti "Surface 1" with lines lc rgb "red" ,\
"data.dat" using 2:1:4 ti "Surface 2" with lines lc rgb "blue"
关于第2点):gnuplot没有z2轴(也没有3D中的x2和y2轴),你不能选择z轴的位置。