Vaggelis_Z
Vaggelis_Z

Reputation: 221

Reading external data files in gnuplot

Well, this is a continuation of my previous question. As, I mentioned, the data files are produced from a Fortran code. All the data files contain two columns of data. In the Fortran code I use the FORMAT (2(1X,D22.16)). So, the output files look like

-.4515533388641104D-01 -.6842652196656712D+01
-.1381692033642749D+00 0.6762844180244199D+01
-.5741668880663318D-01 -.7891086299010933D+01
-.1051164522902431D+00 0.7758389636011907D+01
-.7574000988697732D-01 -.8180315630079706D+01
-.7939204753736680D-01 0.8167097825331970D+01
-.1003250672387262D+00 -.7865995561517515D+01
-.6006135667296913D-01 0.7987393828927278D+01
 ..................... ......................

This is only a small sample portion of one data file. In order to plot this data file I use

plot "data001.out" u 1:2 w d lc rgb 'black'

However, gnuplot fails to read the data correctly and produced this plot

enter image description here

The correct plot, using Mathematica program, is this

enter image description here

I noticed, that if I change the FORMAT to (2(1X,F22.16)) (in decimal form) everything is OK. Why gnuplot cannot read data in exponential form? Is there a way to tell the program how to read this type of data?

Upvotes: 3

Views: 3995

Answers (1)

lev.tuby
lev.tuby

Reputation: 477

From gnuplot 4.6 manual:

"Data may be written in exponential format with the exponent preceded by the letter e or E. The fortran exponential specifiers d, D, q, and Q may also be used if the command set datafile fortran is in effect."

So you should put set datafile fortran before plot.

Hope it helps!

Upvotes: 6

Related Questions