0
votes

I have a binary file - 1 column, 20 values.

The first 10 - x coordinate

the following 10 - corresponding y coordinates.

Is it possible to plot an x-y plot using gnuplot without preprocessing ? If not, how can I preprocess the binary file (not converting it to a normal text file) for plotting in gnuplot ?

1

1 Answers

0
votes

As far as I can see, this is not possible with gnuplot, although it offers massive options for binary files. One possibility to plot your file would be with the following python script (provided, your numbers are stored as integer), otherwise you must adapt it:

import sys
import numpy as np
np.savetxt(sys.stdout, np.fromfile(sys.argv[1], dtype='i4').reshape(2,10).transpose())

and plot it with

plot '< python script.py data.bin'

If you plan to work more with binary data files, I would suggest you to use the HDF5 file format.