首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >gnuplot、splot、3d:无法将屏幕或字符坐标与绘图坐标混合

gnuplot、splot、3d:无法将屏幕或字符坐标与绘图坐标混合
EN

Stack Overflow用户
提问于 2019-03-18 01:43:56
回答 1查看 136关注 0票数 1

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

上述文件的内容如下:

"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是一个;-separated文件;它有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图。但对于曲面,它不知何故失败了。我们该怎么办?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-03-18 02:57:38

该问题是由以下命令引起的

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

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

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

一切都会好起来的。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55210028

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档