【问题标题】:gnuplot: first row of data skippedgnuplot:跳过第一行数据
【发布时间】:2015-02-05 14:14:40
【问题描述】:

我正在使用 gnuplot 5.0。每个脚本都有以下内容:

set terminal epslatex 8 color standalone colortext 

问题是 gnuplot 跳过了第一行。据我所知,4.6 版本解决了类似的问题。

请对这个问题有任何想法吗?

数据文件points.dat示例

4 4
4 -4
-4 4
-4 -4

第一行 (4, 4) 被跳过。因此,gnuplot 只显示三个点,而不是四个点。在此使用的命令

#!/bin/bash


set terminal epslatex 8 color standalone colortext 
set output outputFileName

set size .55,.55
set pointsize 3.0


##############
# Line styles
##############

set linestyle 1 lt 5 lw 1 #
set linestyle 2 lt 2 lw 1.5 
set linestyle 3 lt 6 lw 1 #
set linestyle 4 lt 3 lw 1 
set linestyle 5 lt 2 lw 2 #
set linestyle 6 lt 1 lw 2


##################
# Titles
##################
set title 'Image'
set xlabel '$x$' offset 0,0.5
set ylabel '$y$' offset 2,0


set macros
filename_init = sprintf("%s/image_init.dat",dataFileDirectory)


set key autotitle columnhead
set key horiz


set multiplot
plot
     filename_init  u 1:2 with points lt 0 pt 1 lw 5 lc rgb "magenta" notitle 'initial'  

绕过问题的诀窍是复制第一行。但这并不实用。

【问题讨论】:

  • 您的意思是您正在从数据文件中绘制曲线并且gnuplot 跳过了第一个数据点?您是否介意发布一个示例,其中包含一个简短的数据文件和触发不良行为的最少gnuplot 命令集?提前谢谢你
  • 命令plot 'points.dat' using 1:2 w l 绘制所有四个点,即三行。也许有些只是隐藏在边界后面。使用set offsets 1,1,1,1; plot 'points.dat' using 1:2 w l 我得到了i.stack.imgur.com/kLzj9.png 5.0 的情节,这是正确的。
  • 不是边框的问题。我以前版本的 gnuplot 也有类似的问题。以前的版本 4.6 解决了这个问题,现在新版本出现了。你用的是哪个终端?
  • 适用于qt 和您的epslatex 终端设置。
  • 对不起,我用点而不是线来绘图。 @Christoph,使用积分时对你有用吗?

标签: gnuplot


【解决方案1】:

对于set key autotitle columnheader,gnuplot 使用第一行中的条目作为键条目,即使您为绘图指定了notitle

为了证明这一点,请考虑以下脚本,使用您发布的 points.dat 中的四个数据点:

set terminal pngcairo
set output 'foobar.png'

set offsets 1,1,1,1
set key autotitle columnhead

filename_init = 'points.dat'

set multiplot layout 1,2
plot filename_init u 1:2 with points lt 0 pt 1 lw 5 lc rgb "magenta"

set key noautotitle
plot filename_init u 1:2 with points lt 0 pt 1 lw 5 lc rgb "magenta" title 'initial'
unset multiplot

结果是

所以,只需从脚本中删除行 set key autotitle columnhead,并使用 plot ... title 'initial'。这会给你预期的结果。

【讨论】:

  • 非常感谢 Chistoph
猜你喜欢
  • 2013-10-11
  • 1970-01-01
  • 2016-02-07
  • 1970-01-01
  • 2017-05-11
  • 1970-01-01
  • 2013-09-16
  • 2014-06-07
  • 2013-08-17
相关资源
最近更新 更多