Share

gnuplot development

Tracker: Bugs

5 Bad plot from multiple data files when one file is empty - ID: 2859699
Last Update: Comment added ( sfeam )

Running the following gnuplot v4.2.6 commands on Mac OS X 10.5.8. Otherwise
this installation of gnuplot works perfectly for quite some time.

$ gnuplot
set terminal png nocrop enhanced font Verdana 8 size 400,300
set title "Fixed By Priority" font "Verdana-Bold,10"
set key outside
set xlabel "Time"
set ylabel "Bug Count"
set xdata time
set xtic rotate by -75
set timefmt "%Y-%m-%d"
set format x "%m-%d-%y"
set style data linespoints
set output "Bugzilla_FixedByPriority.png"
plot "Bugzilla_FixedPri1.dat" using 1:3 title 2, \
"Bugzilla_FixedPri2.dat\" using 1:3 title 2, \
"Bugzilla_FixedPri3.dat\" using 1:3 title 2, \
"Bugzilla_FixedPri4.dat\" using 1:3 title 2, \
"Bugzilla_FixedPri5.dat\" using 1:3 title 2, \
"Bugzilla_Fixed.dat\" using 1:2 title 'Total'

Using these data files:

Bugzilla_FixedPri1.dat:
2009-02-13 P1 1
2009-02-16 P1 1
2009-02-19 P1 2
2009-03-03 P1 1
2009-06-29 P1 2
2009-06-30 P1 1

Bugzilla_FixedPri2.dat:
2009-02-19 P2 1
2009-02-20 P2 1
2009-06-26 P2 2
2009-06-29 P2 1

Bugzilla_FixedPri3.dat:
2009-02-20 P3 1
2009-06-26 P3 1

Bugzilla_FixedPri4.dat:
2009-02-18 P4 3
2009-02-20 P4 1
2009-06-26 P4 1

Bugzilla_FixedPri5.dat: (empty file)

Bugzilla_Fixed.dat:
2009-02-13 1
2009-02-16 1
2009-02-18 3
2009-02-19 3
2009-02-20 3
2009-03-03 1
2009-06-26 4
2009-06-29 3
2009-06-30 1

Produces a warning about missing data for Bugzilla_FixedPri5.dat, which is
fine, but it also produces a bad plot image that I've attached to this bug.
If I change the plot command parameters for the missing data from:
"Bugzilla_FixedPri5.dat\" using 1:3 title 2, \
to:
"Bugzilla_FixedPri5.dat\" using 1:3 title 'P5', \
the plot appears correctly. This is also attached.

Somehow the parameter to use a title for the Pri5 line using a column from
the input data file interferes with the graph generation, even though the
missing data should cause it to not affect the generated plot. Using a
static title string fixes the problem, but this plot must get it's labels
from the data file.


David Multer ( dmulter ) - 2009-09-16 01:00

5

Closed

Fixed

Nobody/Anonymous

2D plot

release_critical

Public


Comments ( 3 )




Date: 2009-09-17 16:16
Sender: sfeamProject Admin

OK, fixed in the 4.2 source tree. Will be in 4.2.7 if it ever exists.


Date: 2009-09-16 03:49
Sender: sfeamProject Admin

Followup:

This behavior is partly due to an error in your script (still arguably a
bug, but...)

You ask it to take the title from the header of column 2, but your data
files do not actually have a header line. So in the non-empty files it eats
the first data line thinking it's a header. That works, in the sense that
you do get a title, but you lose the first data point.

In the empty file, it still tries to read a title from the first line,
expecting that even if there is no data in the file you will still have
provided the header record. If you put a real header line in your 5th
file, you will get the [correct] warning that there is no data in the file,
but it will correctly read a title from the header line and produce a
correct plot.

So the bug comes down to a matter of what happens if you instruct the
program to read a title from a line that doesn't exist. Probably it should
issue a warning and set the title to "". But it doesn't.
The work-around is obvious: don't do that.


Date: 2009-09-16 03:00
Sender: sfeamProject Admin

Strange bug.

For what it's worth, the CVS version works and that code will be in the
4.4 release candidate, although you will need to change the syntax
slightly.
Use:
plot "Bugzilla_FixedPri1.dat" using 1:3 title column(2), \
"Bugzilla_FixedPri2.dat" using 1:3 title column(2), \
"Bugzilla_FixedPri3.dat" using 1:3 title column(2), \
"Bugzilla_FixedPri4.dat" using 1:3 title column(2), \
"Bugzilla_FixedPri5.dat" using 1:3 title column(2), \
"Bugzilla_Fixed.dat" using 1:2 title 'Total'

That syntax is accepted by 4.2.6 also (but it doesn't fix anything)

I don't know that this will get fixed in 4.2, since 4.4.rc1 will be out
soon. Bug I may try to find the cause anyhow, since it is possible some
variant might hit 4.4 also.


Log in to comment.

Attached File ( 1 )

Filename Description Download
Bugzilla_FixedByPriority.zip Two PNG image files for bad and good plots Download

Changes ( 4 )

Field Old Value Date By
status_id Open 2009-09-17 16:16 sfeam
resolution_id None 2009-09-17 16:16 sfeam
close_date - 2009-09-17 16:16 sfeam
File Added 343128: Bugzilla_FixedByPriority.zip 2009-09-16 01:00 dmulter