3

Am using gnuplot 5.0. with the following as pereamble to each script:

set terminal epslatex 8 color standalone colortext 

The issue is that gnuplot is skipping the first row. To my knowledge 4.6 version addressed a similar issue.

Any idea on the problem please?

Example of data file points.dat

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

The first line (4, 4) is skipped. So instead of four points, only three are displayed by gnuplot. Herewith the command am using

#!/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'  

On trick to bypass the issue is to duplicate the first row. Bu this is not practical.

7
  • 1
    Do you mean that you're plotting a curve from a data file and gnuplot skips the first data point? Would you mind posting an example, consisting of a short data file and the minimum set of gnuplot commands that trigger the unwanted behavior? Thank you in advance Commented Feb 5, 2015 at 14:20
  • The command plot 'points.dat' using 1:2 w l plots all four points, i.e. three lines. Maybe some are just hidden behind the borders. Using set offsets 1,1,1,1; plot 'points.dat' using 1:2 w l I get the plot i.sstatic.net/kLzj9.png with 5.0, which is correct. Commented Feb 5, 2015 at 15:06
  • It is not a problem of borders. I had similar issues with prior versions of gnuplot. The previous version, 4.6, solved the issue, which is now showing up with the new version. Which terminal are you using? Commented Feb 5, 2015 at 15:09
  • Works fine both with qt and your epslatex terminal settings. Commented Feb 5, 2015 at 15:12
  • Sorry, am ploting with points not lines. @Christoph, does it work for you when using points? Commented Feb 5, 2015 at 15:12

1 Answer 1

3

With set key autotitle columnheader gnuplot uses the entries in the first row as key entries, even though for the plot you have specified notitle.

To demonstrate this, consider the following script, using the four data points in points.dat, which you posted:

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

The result is

enter image description here

So, just remove the line set key autotitle columnhead from your script, and use plot ... title 'initial'. That gives you the expected result.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.