XLABEL 未能统一出现在带有 macro 的 multiplot subplots
XLABEL failed to uniformly appear in multiplot subplots with macro
我正在使用 gnuplot(版本 5.2
)中的 multiplot
命令在同一帧中绘制多个数据文件。我能够重现我在下面的代码中遇到的问题,例如我正在绘制简单的 sin
-函数而不是数据文件。
代码
reset session
# ****** margins *****
if (!exists("MP_LEFT")) MP_LEFT = 0.1
if (!exists("MP_RIGHT")) MP_RIGHT = 0.95
if (!exists("MP_BOTTOM")) MP_BOTTOM = 0.075
if (!exists("MP_TOP")) MP_TOP = 0.925
if (!exists("MP_GAP")) MP_GAP = 0.025
# ****** Macros *****
XLABEL = "set xlabel '{/:Italic=20 x}' offset graph 0, 0.3"
NOXLABEL = "unset xlabel"
NOXTICS = "set format x ''"
NOYTICS = "set format y ''"
OBJECT = "unset object; set object circle at graph 0, 0 radius scr 0.1"
set terminal pngcairo
set termoption font "Times, 12"
set output "test.png"
set multiplot layout 2, 2 rowsfirst \
margins scr MP_LEFT, MP_RIGHT, MP_BOTTOM, MP_TOP \
spacing scr MP_GAP
@NOXLABEL
@XLABEL
@NOXTICS
@NOYTICS
@OBJECT
plot sin(x) w l title "sin(x)"
@NOXLABEL
@XLABEL
@NOXTICS
@NOYTICS
plot sin(x + pi/4) w l title "sin(x + {/Symbol p}/4)"
@NOXLABEL
@XLABEL
@OBJECT
@NOXTICS
@NOYTICS
plot sin(x + pi/2) w l title "sin(x + {/Symbol p}/2)"
@NOXLABEL
@XLABEL
@OBJECT
@NOXTICS
@NOYTICS
plot sin(x + pi) w l title "sin(x + {/Symbol p})"
unset multiplot
unset output
宏在多图中非常有用,因为它有助于在所有子图中共享类似的命令,例如我正在使用宏 OBJECT
。但是,在这里我无法理解为什么我使用宏 XLABEL
为 xlabels 选择的偏移量会在不同子图上相对于 xaxis
产生不同的偏移,尤其是 (line:1, col:1) 和 (line:2, col:1) 在下面的结果中。
结果
任何人都可以帮助解决宏中 xlabel 的错误行为吗?
欢迎对问题进行解释。
如果您使用例如offset screen 0,0.15
或 offset 0,4
而不是 offset graph 0.3
。
这可能会解决问题,但无法解释 offset graph
的意外行为。错误?至少在多地块环境中具有子地块的起源和大小。但这与宏本身无关。检查以下进一步简化的示例。
代码 1:
reset session
set multiplot layout 2,2 rowsfirst
set xlabel "x label" offset graph 0, 0.3
plot x
plot x
plot x
plot x
unset multiplot
结果 1:
代码2:
reset session
set multiplot layout 2,2 rowsfirst
set xlabel "x label" offset screen 0, 0.15
plot x
plot x
plot x
plot x
unset multiplot
结果二:
我正在使用 gnuplot(版本 5.2
)中的 multiplot
命令在同一帧中绘制多个数据文件。我能够重现我在下面的代码中遇到的问题,例如我正在绘制简单的 sin
-函数而不是数据文件。
代码
reset session
# ****** margins *****
if (!exists("MP_LEFT")) MP_LEFT = 0.1
if (!exists("MP_RIGHT")) MP_RIGHT = 0.95
if (!exists("MP_BOTTOM")) MP_BOTTOM = 0.075
if (!exists("MP_TOP")) MP_TOP = 0.925
if (!exists("MP_GAP")) MP_GAP = 0.025
# ****** Macros *****
XLABEL = "set xlabel '{/:Italic=20 x}' offset graph 0, 0.3"
NOXLABEL = "unset xlabel"
NOXTICS = "set format x ''"
NOYTICS = "set format y ''"
OBJECT = "unset object; set object circle at graph 0, 0 radius scr 0.1"
set terminal pngcairo
set termoption font "Times, 12"
set output "test.png"
set multiplot layout 2, 2 rowsfirst \
margins scr MP_LEFT, MP_RIGHT, MP_BOTTOM, MP_TOP \
spacing scr MP_GAP
@NOXLABEL
@XLABEL
@NOXTICS
@NOYTICS
@OBJECT
plot sin(x) w l title "sin(x)"
@NOXLABEL
@XLABEL
@NOXTICS
@NOYTICS
plot sin(x + pi/4) w l title "sin(x + {/Symbol p}/4)"
@NOXLABEL
@XLABEL
@OBJECT
@NOXTICS
@NOYTICS
plot sin(x + pi/2) w l title "sin(x + {/Symbol p}/2)"
@NOXLABEL
@XLABEL
@OBJECT
@NOXTICS
@NOYTICS
plot sin(x + pi) w l title "sin(x + {/Symbol p})"
unset multiplot
unset output
宏在多图中非常有用,因为它有助于在所有子图中共享类似的命令,例如我正在使用宏 OBJECT
。但是,在这里我无法理解为什么我使用宏 XLABEL
为 xlabels 选择的偏移量会在不同子图上相对于 xaxis
产生不同的偏移,尤其是 (line:1, col:1) 和 (line:2, col:1) 在下面的结果中。
结果
任何人都可以帮助解决宏中 xlabel 的错误行为吗? 欢迎对问题进行解释。
如果您使用例如offset screen 0,0.15
或 offset 0,4
而不是 offset graph 0.3
。
这可能会解决问题,但无法解释 offset graph
的意外行为。错误?至少在多地块环境中具有子地块的起源和大小。但这与宏本身无关。检查以下进一步简化的示例。
代码 1:
reset session
set multiplot layout 2,2 rowsfirst
set xlabel "x label" offset graph 0, 0.3
plot x
plot x
plot x
plot x
unset multiplot
结果 1:
代码2:
reset session
set multiplot layout 2,2 rowsfirst
set xlabel "x label" offset screen 0, 0.15
plot x
plot x
plot x
plot x
unset multiplot
结果二: