FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

CHANGE: The number of valid columns in the first line of a data line... · gnuplot/gnuplot@ee3a4f0 · GitHub

Repository navigation

Commit ee3a4f0

Browse files
Ethan A Merritt
committed
CHANGE: The number of valid columns in the first line of a data line...
is used to decide the interpretation of all lines in the file.
1 parent 5d92b70 commit ee3a4f0

5 files changed

Lines changed: 71 additions & 35 deletions

File tree

‎ChangeLog‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
2012-05-02 Ethan A Merritt <merritt@u.washington.edu>
2+
3+
* src/datafile.c (df_readascii): CHANGE long-standing program action to
4+
check every input data line individually for number of data columns.
5+
Instead, whatever number of columns are found in the first record, that
6+
same number is expected for the rest of the input file.
7+
This is not ideal, because plot 'foo' with points will now fail if 'foo'
8+
has 4 or more entries on the first line but only 3 on subsequent lines.
9+
On the other hand, it fixes the unexpected behavior that
10+
3 NaN
11+
in record 5, for example, would be treated as (5,3) DEFINED
12+
rather than as (3,NaN) UNDEFINED.
13+
14+
* docs/gnuplot.doc docs/figure_missing.pdf: Documentation and example
15+
for above change.
16+
117
2012-04-30 Ethan A Merritt <merritt@u.washington.edu>
218

319
* src/term.c (do_arc): A bug in the new wedge/nowedge option left a

‎NEWS‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ New features, changes and fixes since gnuplot version 4.6
99
* CHANGE 'set [xyz]axis ... reverse' affects only auto-scaling
1010
* CHANGE Revised handling of NaN in input data stream
1111
* CHANGE Remove the BACKWARDS_COMPATIBLE build option (deprecated since v4.0)
12+
* CHANGE The number of valid columns in the first line of a data line
13+
is used to decide the interpretation of all lines in the file.
1214

1315

1416
New features, changes and fixes in gnuplot version 4.6

‎docs/figure_missing.pdf‎

15 KB
Binary file not shown.

‎docs/gnuplot.doc‎

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
C RCS $Id: gnuplot.doc,v 1.729 2012/04/20 19:36:02 sfeam Exp $
1+
C RCS $Id: gnuplot.doc,v 1.730 2012/04/23 19:25:15 sfeam Exp $
22
C
33
C Copyright (C) 1986 - 1993, 1998, 1999, 2000, 2001, 2004 Thomas Williams, Colin Kelley et al.
44
C
@@ -203,9 +203,14 @@ C
203203

204204
2 New features
205205
?new-features
206-
This section lists major additions since version 4.6.
206+
This section lists major additions and changes since version 4.6.
207207
For a more exhaustive list, see the NEWS file.
208-
3 NOTHING HERE YET
208+
209+
* New coordinate system (Degrees, Minutes, Seconds). See `set xdata geographic`.
210+
211+
* New support for 32-bit Alpha channel + RGB colors #AARRGGBB. See `colorspec`.
212+
213+
* Changed handling of NaN or other unexpected input data. See `missing`.
209214

210215
2 Deprecated syntax
211216
?deprecated syntax
@@ -2107,8 +2112,6 @@ Ffigure_newsyntax
21072112
?tc
21082113
?textcolor
21092114
Many commands allow you to specify a linetype with an explicit color.
2110-
Terminal-independent color choice is only possible for terminals that support
2111-
RGB color or pm3d palettes.
21122115

21132116
Syntax:
21142117

@@ -2119,6 +2122,7 @@ Ffigure_newsyntax
21192122

21202123
rgbcolor "colorname"
21212124
rgbcolor "#RRGGBB"
2125+
rgbcolor "#AARRGGBB"
21222126
rgbcolor variable # color is read from input file
21232127
palette frac <val> # <val> runs from 0 to 1
21242128
palette cb <value> # <val> lies within cbrange
@@ -2136,6 +2140,13 @@ Ffigure_newsyntax
21362140
be represented by #FF00FF, which is the hexadecimal representation of
21372141
(255 << 16) + (0 << 8) + (255).
21382142

2143+
"#AARRGGBB" represents an RGB color with an alpha channel (transparency)
2144+
value in the high bits. An alpha value of 0 represents a fully opaque color;
2145+
i.e., "#00RRGGBB" is the same as "#RRGGBB". An alpha value of 255 (FF)
2146+
represents full transparency. `Note`: This convention for the alpha channel
2147+
is backwards from that used by the "with rgbalpha" image plot mode in earlier
2148+
versions of gnuplot.
2149+
21392150
The color palette is a linear gradient of colors that smoothly maps a
21402151
single numerical value onto a particular color. Two such mappings are always
21412152
in effect. `palette frac` maps a fractional value between 0 and 1 onto the
@@ -7469,17 +7480,22 @@ Ffigure_mapcontours
74697480
?show datafile missing
74707481
?set missing
74717482
?missing
7472-
The `set datafile missing` command allows you to tell `gnuplot` what character
7473-
string is used in a data file to denote missing data. Exactly how this missing
7474-
value will be treated depends on the `using` specifier of the `plot` or `splot`
7475-
command.
7483+
The `set datafile missing` command tells `gnuplot` there is a special string
7484+
used in input data files to denote a missing data entry. There is no default
7485+
character for `missing`, but in many cases any non-parsible string of
7486+
characters found where a numerical value is expected will cause the line to be
7487+
treated as missing data. There is a distinction between missing data and
7488+
invalid data (e.g. "NaN", 1/0.). Invalid data causes a gap in the line drawn
7489+
through the points; missing data does not.
7490+
74767491
Syntax:
7477-
set datafile missing {"<string>"}
7492+
set datafile missing "<string>"
74787493
show datafile missing
74797494
unset datafile
7480-
Example:
7481-
# Ignore entries containing IEEE NaN ("Not a Number") code
7482-
set datafile missing "NaN"
7495+
7496+
`Note`: The treatment of certain cases has changed in this version of gnuplot.
7497+
The example below shows the difference.
7498+
Ffigure_missing
74837499
Example:
74847500
set style data linespoints
74857501
plot '-' title "(a)"
@@ -7500,32 +7516,28 @@ Ffigure_mapcontours
75007516
plot '-' using 1:2 title "(c)"
75017517
1 10
75027518
2 20
7503-
3 ?
7519+
3 NaN
75047520
4 40
75057521
5 50
75067522
e
75077523
plot '-' using 1:($2) title "(d)"
75087524
1 10
75097525
2 20
7510-
3 ?
7526+
3 NaN
75117527
4 40
75127528
5 50
75137529
e
75147530

7515-
The first `plot` will recognize only the first datum in the "3 ?" line. It
7516-
will use the single-datum-on-a-line convention that the line number is "x"
7517-
and the datum is "y", so the point will be plotted (in this case erroneously)
7518-
at (2,3).
7519-
7520-
The second and third `plot` commands will correctly ignore the middle line.
7521-
The plotted line will connect the points at (2,20) and (4,40).
7531+
Plot (a) differs because the third line contains only one valid number.
7532+
Old gnuplot versions switched to a single-datum-on-a-line convention that the
7533+
line number is "x" and the datum is "y", erroneously placing the point at(2,3).
75227534

7523-
The fourth `plot` will also correctly ignore the middle line, but the plotted
7524-
line will not connect the points at (2,20) and (4,40).
7535+
Both the old and new gnuplot versions handle the same data correctly if the
7536+
'?' character is designated as a marker for missing data (b).
75257537

7526-
There is no default character for `missing`, but in many cases any
7527-
non-parsible string of characters found where a numerical value is expected
7528-
will be treated as missing data.
7538+
Old gnuplot versions handled NaN differently depending of the form of the
7539+
`using` clause, as shown in plots (c) and (d). Gnuplot now handles NaN the
7540+
same whether the input column was specified as N or ($N).
75297541

75307542
4 set datafile separator
75317543
?set datafile separator
@@ -7550,23 +7562,21 @@ Ffigure_mapcontours
75507562
4 set datafile commentschars
75517563
?set datafile commentschars
75527564
?commentschars
7553-
The `set datafile commentschars` command allows you to tell `gnuplot` what
7554-
characters are used in a data file to denote comments. Gnuplot will ignore
7555-
rest of the line behind the specified characters if either of them is the
7556-
first non-blank character on the line.
7565+
The `set datafile commentschars` tells `gnuplot` what characters are used in a
7566+
data file to begin comment lines. If the first non-blank character on a line is
7567+
one of the specified characters then the rest of the input line is ignored.
7568+
Default value of the string is "#!" on VMS and "#" otherwise.
75577569

75587570
Syntax:
75597571
set datafile commentschars {"<string>"}
75607572
show datafile commentschars
75617573
unset commentschars
75627574

7563-
Default value of the string is "#!" on VMS and "#" otherwise.
7564-
75657575
Then, the following line in a data file is completely ignored
75667576
# 1 2 3 4
75677577
but the following
75687578
1 # 3 4
7569-
produces rather unexpected plot unless
7579+
produces a rather unexpected plot unless
75707580
set datafile missing '#'
75717581
is specified as well.
75727582

‎src/datafile.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#ifndef lint
2-
static char *RCSid() { return RCSid("$Id: datafile.c,v 1.218 2012/04/17 22:42:52 sfeam Exp $"); }
2+
static char *RCSid() { return RCSid("$Id: datafile.c,v 1.219 2012/05/02 04:21:58 sfeam Exp $"); }
33
#endif
44

55
/* GNUPLOT - datafile.c */
@@ -1954,6 +1954,14 @@ df_readascii(double v[], int max)
19541954
|| output == df_no_use_specs
19551955
|| output == max);
19561956

1957+
/*
1958+
* EAM Apr 2012 - If there is no using spec, then whatever we found on
1959+
* the first line becomes the expectation for the rest of the input file.
1960+
* THIS IS A CHANGE!
1961+
*/
1962+
if (df_no_use_specs == 0)
1963+
df_no_use_specs = output;
1964+
19571965
return output;
19581966

19591967
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL