gnuplot,splot,3d:不能混合屏幕或字符coords与情节coords

问题描述 投票:0回答:1

我有以下设置。有一个csv文件mini.csv,一个gnuplot脚本mwe.plt和一个shell脚本mwe.sh来运行它。我得到的错误如下:enter image description here

上述文件的内容如下:

"A1";"A2";"A3";"A4";"A5";"A6";"A7"
"mst";44.6410256410256;25.2820512820513;259.538461538462;86.9230769230769;0.05;0.05
"mst";93.7283950617284;53.3827160493827;282.679012345679;85.9876543209877;0.15;0.05
"mst";158.119047619048;92.1111111111111;277.253968253968;91.7063492063492;0.25;0.05
"mst";210.322916666667;123.145833333333;285.427083333333;81.9583333333333;0.35;0.05
"mst";278.308641975309;164.444444444444;298.185185185185;79.8765432098765;0.45;0.05
"mst";334.4;199.885714285714;294.152380952381;78.0285714285714;0.55;0.05
"mst";395.571428571429;234.5;281.428571428571;80.3095238095238;0.65;0.05
"mst";427.740740740741;267.333333333333;309.074074074074;75;0.75;0.05
"mst";462.333333333333;317;340;91.3333333333333;0.85;0.05
"mst";44.9230769230769;25.25;260.269230769231;100.730769230769;0.05;0.15
"mst";94.0648148148148;53.287037037037;279.055555555556;100.648148148148;0.15;0.15
"mst";158.255952380952;91.9285714285714;280.803571428571;106.625;0.25;0.15
"mst";209.328125;121.8046875;288.0234375;96.546875;0.35;0.15
"mst";278.851851851852;163.601851851852;296.601851851852;94.0277777777778;0.45;0.15
"mst";335.414285714286;198.792857142857;295.107142857143;91.9928571428571;0.55;0.15
"mst";395;234.25;286.660714285714;93.125;0.65;0.15
"mst";427.611111111111;265.777777777778;316.305555555556;88.5277777777778;0.75;0.15

基本上,mini.csv是一个;分隔文件;它有7列,其中最后一列我认为是xy,并且想要对它们绘制第4列和第5列。

接下来,我的绘图脚本:

# this is needed to ignore the header
set key autotitle columnhead
unset key
set datafile separator ";"
set terminal epslatex color size 8,4
set output outfile

# set multiplot layout 1,2;
set key below

set style line 1 \
    linecolor rgb '#23000000' \
    linetype 1 lw 3 \
    pointtype 2 pointsize 1\
    dt 1

set style line 2 \
    linecolor rgb '#23E69F00' \
    linetype 1 lw 3 \
    pointtype 3 pointsize 1 \
    dt 2

set style line 3 \
    linecolor rgb '#2356B4E9' \
    linetype 1 lw 3 \
    pointtype 4 pointsize 1\
    dt 3

set style line 4 \
    linecolor rgb '#23009E73' \
    linetype 1 lw 3 \
    pointtype 5 pointsize 1\
    dt 4

set style line 5 \
    linecolor rgb '#23F0E442' \
    linetype 1 lw 3 \
    pointtype 7 pointsize 1\
    dt 5

set style line 6 \
    linecolor rgb '#230072B2' \
    linetype 1 lw 3 \
    pointtype 8 pointsize 1\
    dt 6

set logscale x 2
set logscale y 2
set logscale z 2

set xlabel "\\texttt{x coords}" offset 0, graph 1
set xtics rotate
set xtics format '%.4f'

set mytics 5
set ylabel "\\texttt{y coords}" offset 0.5,0
set ytics format '%.4f'

splot filename using 6:7:($4/1000.00) with linespoints title "A4" ls 3,\
      filename using 6:7:($5/1000.00) with linespoints title "A5" ls 4

最后,剧本来了:

gnuplot -e "filename='mini.csv'" -e "outfile='tmptex.tex'" mwe.plt
pdflatex pic.tex
okular pic.pdf

我使用相同的脚本来绘制常规的2d图。但对于表面,它有点失败。我们应该做什么?

3d gnuplot
1个回答
2
投票

问题是由命令引起的

set xlabel "\\texttt{x coords}" offset 0, graph 1

问题是“偏移”的默认单位是字符宽度,因此“偏移0,图1”转换为“在x上偏移0个字符宽度,在y上偏移1个图形高度”。但是,正如错误消息所示,程序不喜欢将这两个单元混合在一个偏移中。由于0无论单位是什么仍为0,您可以将其更改为

set xlabel "\\texttt{x coords}" offset graph 0, graph 1

一切都应该好。

© www.soinside.com 2019 - 2024. All rights reserved.