Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Andrew: I see no reason to make gnuplot handle those extra bytes before/after your data. Either Fortran does not do this padding, or it does and gnuplot handles it without a hassle. </p> <p>I've had a similar problem, and Google searches always brought me back here. I figured I'd better post my solution in case the same happens to other people. </p> <p>I've been trying to make a 2D colormap plot using gnuplot's "plot 'file.dat' matrix with image" command. My ASCII output files were too big, so I wanted to use binary files instead. What I did was something like the following: </p> <p>in fortran:</p> <pre><code>implicit none real, dimension(128,128) :: array integer :: irec ! ... initialize array ... inquire( iolength=irec ) array open( 36, 'out.dat', form='unformatted', access='direct', recl=irec ) write( 36, rec=1 ) array close( 36, status='keep' ) </code></pre> <p>in gnuplot: </p> <pre><code>plot 'out.dat' binary array=128x128 format="%float" with image </code></pre> <p>Notes: </p> <ul> <li><p>By default, gnuplot assumes single precision in binary files. If your fortran program outputs in double precision, simply change "%float" to "%double". </p></li> <li><p>My program used double precision data in the array, but output files were too big. Since images based on double or single precision are indistinguishable to the eye, and double-precision data files are large, I converted my double-precision data to single-precision data before writing it to a file. </p></li> <li><p>You may have to adapt the gnuplot command depending on what you want to do with the matrix, but this loads it in and plots it well. This did what I needed it to do, and I hope it helps anyone<br> else who has a similar problem. </p></li> <li><p>As you can see, if Fortran adds extra bytes before/after your data, gnuplot seems to read in the data without making you take those extra bytes into account. </p></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload