【问题标题】:gnuplot errors: " line 114: warning: Skipping data file with no valid points", " line 114: all points y value undefined!". "Cannot find or open file"gnuplot 错误:“第 114 行:警告:跳过没有有效点的数据文件”、“第 114 行:所有点 y 值未定义!”。 “找不到或打开文件”
【发布时间】:2020-10-22 16:12:52
【问题描述】:

这是我的数据文件的图像: EPAM_2000_160.txt 当我通过 cmd 提示符运行它时,它给出了一个错误:“找不到或打开文件“EPAM_2000_160.txt”,图中没有数据”。 这两个文件都存在于文档的同一文件夹中。我不明白为什么它无法找到。 这是.plt文件的代码:

#set terminal x11 
#set output
unset clip points
set clip one
unset clip two
set bar 1.000000
set border 31 lt -1 lw 1.000
set xdata time
set ydata time
set zdata time
set x2data time
set y2data time
set cbdata time
set timefmt "%d/%m/%y,%H:%M"
set timefmt "%d/%m/%y,%H:%M"
set timefmt "%d/%m/%y,%H:%M"
set timefmt "%d/%m/%y,%H:%M"
set timefmt "%d/%m/%y,%H:%M"
set timefmt "%d/%m/%y,%H:%M"
set boxwidth
set style fill empty border
set dummy x,y
set format x "% g"
set format y "% g"
set format x2 "% g"
set format y2 "% g"
set format z "% g"
set format cb "% g"
set angles radians
unset grid
set key title ""
set key right top Right noreverse enhanced box linetype -2 linewidth 1.000 samplen 4 spacing 1 width 0 height 0 autotitles
unset label
unset arrow
unset style line
unset style arrow
unset logscale
set offsets 0, 0, 0, 0
set pointsize 1
set encoding default
unset polar
unset parametric
unset decimalsign
set view 60, 30, 1, 1
set samples 100, 100
set isosamples 10, 10
set surface
unset contour
set clabel '%8.3g'
set mapping cartesian
set datafile separator whitespace
unset hidden3d
set cntrparam order 4
set cntrparam linear
set cntrparam levels auto 5
set cntrparam points 5
set size ratio 0 1,1
set origin 0,0
set style data points
set style function lines
set xzeroaxis lt -2 lw 1.000
set yzeroaxis lt -2 lw 1.000
set x2zeroaxis lt -2 lw 1.000
set y2zeroaxis lt -2 lw 1.000
set tics in
set ticslevel 0.5
set tics scale 1 
set mxtics default
set mytics default
set mztics default
set mx2tics default
set my2tics default
set mcbtics default
set xtics border mirror norotate autofreq 
set ytics border mirror norotate autofreq 
set ztics border nomirror norotate autofreq 
set nox2tics
set noy2tics
set cbtics border mirror norotate autofreq 
set title "" offset 0.000000,0.000000 font ""
set timestamp "" bottom norotate offset 0.000000,0.000000  font ""
set rrange [ * : * ] noreverse nowriteback  # (currently [0.00000:10.0000] )
set trange [ * : * ] noreverse nowriteback  # (currently [-5.00000:5.00000] )
set urange [ * : * ] noreverse nowriteback  # (currently [-5.00000:5.00000] )
set vrange [ * : * ] noreverse nowriteback  # (currently [-5.00000:5.00000] )
set xlabel "DOY 2000" offset 0.000000,0.000000  font ""
set x2label "" offset 0.000000,0.000000  font ""
set xrange [ 160.3 : 160.44 ] noreverse nowriteback  # (currently [-10.0000:10.0000] )
set x2range [ * : * ] noreverse nowriteback  # (currently [-10.0000:10.0000] )
set ylabel "Ion intensity Sector Avg,1/(cm**2-s-sr-MeV) LEMS120" offset 0.000000,0.000000  font ""
set y2label "" offset 0.000000,0.000000  font ""
set yrange [ 1. : * ] noreverse nowriteback  # (currently [-10.0000:10.0000] )
set y2range [ * : * ] noreverse nowriteback  # (currently [-10.0000:10.0000] )
set zlabel "" offset 0.000000,0.000000  font ""
set zrange [ * : * ] noreverse nowriteback  # (currently [-10.0000:10.0000] )
set cblabel "" offset 0.000000,0.000000  font ""
set cbrange [ * : * ] noreverse nowriteback  # (currently [-10.0000:10.0000] )
set zero 1e-08
set lmargin -1
set bmargin -1
set rmargin -1
set tmargin -1
set locale "C"
set pm3d scansautomatic flush begin noftriangles nohidden3d implicit corners2color mean
unset pm3d
set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB 
set palette rgbformulae 7, 5, 15
set colorbox default
set colorbox vertical origin 0.9,0.2 size 0.1,0.63 bdefault
set loadpath 
set fontpath 
set fit noerrorvariables
set arrow from 160.36,1. to 160.36,700000 nohead
plot 'EPAM_2000_160.txt' u 1:2 t '0.047-0.068 MeV'    
set term post colour eps enh
set output "EPAM_2000_160.eps"
replot
set output
set term x11
#    EOF

【问题讨论】:

  • 控制台窗口中的路径是什么?你如何启动gnuplot? gnuplot.exe 位于哪里?您是否尝试过给出绝对路径,例如plot 'C:\user\xxx\data\whatever\EPAM_2000_160.txt' ?在路径中使用 '\' 时请注意单引号。我假设您使用的是 Windows。
  • 是的,我也尝试过使用绝对路径。现在我也尝试直接绘制文本文件,即第 114 行,而不通过 .plt 文件......而且效果很好......所以 .plt 文件有问题

标签: cmd gnuplot mingw undefined file-not-found


【解决方案1】:

如果您使用绝对链接打开文件,请确保将每个反斜杠加倍,因为反斜杠需要在 C/C++ 字符串中转义。

否则,请确保文件的相对路径对于应用程序启动的当前路径是正确的。

【讨论】:

    【解决方案2】:

    非常感谢!虽然我认为 .plt 文件本身有问题。因为我能够仅绘制文本文件而无需通过 .plt 文件。我已将其保存为新的 .plt 文件。因此,我将一一添加旧命令并找出问题所在。 这是新 .plt 文件的代码:

    # set terminal windows 0 color solid butt enhanced standalone
    # set output
    unset clip points
    set clip one
    unset clip two
    set errorbars front 1.000000 
    set border 31 front lt black linewidth 1.000 dashtype solid
    set zdata 
    set ydata 
    set xdata 
    set y2data 
    set x2data 
    set boxwidth
    set style fill  empty border
    set style rectangle back fc  bgnd fillstyle   solid 1.00 border lt -1
    set style circle radius graph 0.02 
    set style ellipse size graph 0.05, 0.03 angle 0 units xy
    set dummy x, y
    set format x "% h" 
    set format y "% h" 
    set format x2 "% h" 
    set format y2 "% h" 
    set format z "% h" 
    set format cb "% h" 
    set format r "% h" 
    set ttics format "% h"
    set timefmt "%d/%m/%y,%H:%M"
    set angles radians
    set tics back
    unset grid
    unset raxis
    set theta counterclockwise right
    set style parallel front  lt black linewidth 2.000 dashtype solid
    set key title "" center
    set key fixed right top vertical Right noreverse enhanced autotitle nobox
    set key noinvert samplen 4 spacing 1 width 0 height 0 
    set key maxcolumns 0 maxrows 0
    set key noopaque
    unset label
    unset arrow
    set style increment default
    unset style line
    unset style arrow
    set style histogram clustered gap 2 title textcolor lt -1
    unset object
    set style textbox transparent margins  1.0,  1.0 border  lt -1 linewidth  1.0
    set offsets 0, 0, 0, 0
    set pointsize 1
    set pointintervalbox 1
    set encoding cp1252
    unset polar
    unset parametric
    unset decimalsign
    unset micro
    unset minussign
    set view 60, 30, 1, 1
    set view azimuth 0
    set rgbmax 255
    set samples 100, 100
    set isosamples 10, 10
    set surface 
    unset contour
    set cntrlabel  format '%8.3g' font '' start 5 interval 20
    set mapping cartesian
    set datafile separator whitespace
    unset hidden3d
    set cntrparam order 4
    set cntrparam linear
    set cntrparam levels 5
    set cntrparam levels auto
    set cntrparam firstlinetype 0 unsorted
    set cntrparam points 5
    set size ratio 0 1,1
    set origin 0,0
    set style data points
    set style function lines
    unset xzeroaxis
    unset yzeroaxis
    unset zzeroaxis
    unset x2zeroaxis
    unset y2zeroaxis
    set xyplane relative 0.5
    set tics scale  1, 0.5, 1, 1, 1
    set mxtics default
    set mytics default
    set mztics default
    set mx2tics default
    set my2tics default
    set mcbtics default
    set mrtics default
    set nomttics
    set xtics border in scale 1,0.5 mirror norotate  autojustify
    set xtics  norangelimit autofreq 
    set ytics border in scale 1,0.5 mirror norotate  autojustify
    set ytics  norangelimit autofreq 
    set ztics border in scale 1,0.5 nomirror norotate  autojustify
    set ztics  norangelimit autofreq 
    unset x2tics
    unset y2tics
    set cbtics border in scale 1,0.5 mirror norotate  autojustify
    set cbtics  norangelimit autofreq 
    set rtics axis in scale 1,0.5 nomirror norotate  autojustify
    set rtics  norangelimit autofreq 
    unset ttics
    set title "" 
    set title  font "" textcolor lt -1 norotate
    set timestamp bottom 
    set timestamp "" 
    set timestamp  font "" textcolor lt -1 norotate
    set trange [ * : * ] noreverse nowriteback
    set urange [ * : * ] noreverse nowriteback
    set vrange [ * : * ] noreverse nowriteback
    set xlabel "" 
    set xlabel  font "" textcolor lt -1 norotate
    set x2label "" 
    set x2label  font "" textcolor lt -1 norotate
    set xrange [ * : * ] noreverse writeback
    set x2range [ * : * ] noreverse writeback
    set ylabel "" 
    set ylabel  font "" textcolor lt -1 rotate
    set y2label "" 
    set y2label  font "" textcolor lt -1 rotate
    set yrange [ * : * ] noreverse writeback
    set y2range [ * : * ] noreverse writeback
    set zlabel "" 
    set zlabel  font "" textcolor lt -1 norotate
    set zrange [ * : * ] noreverse writeback
    set cblabel "" 
    set cblabel  font "" textcolor lt -1 rotate
    set cbrange [ * : * ] noreverse writeback
    set rlabel "" 
    set rlabel  font "" textcolor lt -1 norotate
    set rrange [ * : * ] noreverse writeback
    unset logscale
    unset jitter
    set zero 1e-08
    set lmargin  -1
    set bmargin  -1
    set rmargin  -1
    set tmargin  -1
    set locale "English_India.1252"
    set pm3d explicit at s
    set pm3d scansautomatic
    set pm3d interpolate 1,1 flush begin noftriangles noborder corners2color mean
    set pm3d nolighting
    set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB 
    set palette rgbformulae 7, 5, 15
    set colorbox default
    set colorbox vertical origin screen 0.9, 0.2 size screen 0.05, 0.6 front  noinvert bdefault
    set style boxplot candles range  1.50 outliers pt 7 separation 1 labels auto unsorted
    set loadpath 
    set fontpath 
    set psdir
    set fit brief errorvariables nocovariancevariables errorscaling prescale nowrap v5
    GNUTERM = "windows"
    ## Last datafile plotted: "EPAM_2000_160_CUT.txt"
    plot "EPAM_2000_160_CUT.txt" u 1:2 t '0.047-0.068 MeV' , "EPAM_2000_160_CUT.txt" u 1:3 t'0.068-0.115 MeV' , "EPAM_2000_160_CUT.txt" u 1:4 t'0.115-0.195 MeV' , "EPAM_2000_160_CUT.txt" u 1:5 t'0.195-0.321 MeV'
    #    EOF
    

    【讨论】:

      猜你喜欢
      • 2019-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多