Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #2772

Scatter plot from a binary data

X-Received by 10.66.140.66 with SMTP id re2mr6327923pab.29.1424462128692; Fri, 20 Feb 2015 11:55:28 -0800 (PST)
X-Received by 10.182.250.200 with SMTP id ze8mr106836obc.3.1424462128522; Fri, 20 Feb 2015 11:55:28 -0800 (PST)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!hl2no20047364igb.0!news-out.google.com!db6ni32977igc.0!nntp.google.com!hl2no20047359igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.graphics.apps.gnuplot
Date Fri, 20 Feb 2015 11:55:28 -0800 (PST)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=128.183.162.49; posting-account=lUmL5QoAAACbs-G_-tErVo4FjxscsHz4
NNTP-Posting-Host 128.183.162.49
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <5af7b56d-4f68-4876-b654-eaf7b8fdbcd6@googlegroups.com> (permalink)
Subject Scatter plot from a binary data
From maksym.petrenko@gmail.com
Injection-Date Fri, 20 Feb 2015 19:55:28 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Received-Bytes 3312
X-Received-Body-CRC 1410483677
Xref csiph.com comp.graphics.apps.gnuplot:2772

Show key headers only | View raw


Hi guys, I'm trying to marry nco tools and gnuplot to produce a scatter plot of some fairly large data. A short version of the question is this. Given a binary file of 4 float numbers:

#X1#X2#Y1#Y2


I'd like to build a scatter plot that has points (x:X1,y:Y1), (x:X2,y:Y2). I tried several things, like this for example:


plot 'scatter00' binary record=(2):(2) format="%float" using 1:2 lc rgb 'blue' title '' 


However, all of them seem to produce a version of (x:X1,y:X2), (x:Y1,y:Y2). I wonder if there is a way to tell gnuplot the file contains ALL elements of X followed by ALL elements of Y, rather than pairs of Xn,Yn?



A long version of the question:

As an input, I have an .nc file with two FLOAT variables, x and y, of the same size - say 100,000,000 points each. Since gnuplot does not work with .nc files directly, I need to somehow serialize the file. My current approach is to dump each x and y to separate text files using ncks, each file essentially a column of float numbers, and then merge these files into a single two-column CSV-like file using Unix 'paste'. While dumping takes about a minute, merging takes about 2-3 minutes. Plotting takes about 5 seconds. Now, the reason I need to merge the two files is because gnuplot expects the input data to be in a form of records:

X1 Y1
X2 Y2
...
Xn Yn

In the same time, ncks can dump data only sequentially, either to separate files or to a single file: 
X1
X2
...
Xn
Y1
Y2
...
Yn

I then tried to dump to a binary file with an idea that gnuplot can read in the binary file as an array and manipulate it according to rows/columns. Again, ncks gives me something like this:

(#X1#X2...#Xn#Y1#Y2...#Yn)

Gnuplot, on the other hand, expects something like this:

(#X1#Y1#X2#Y2...)

When I try this command:

plot 'scatter00' binary record=(600000):(600000) format="%float" using 1:2 lc rgb 'blue' title '' 

I expect gnuplot to read in 600000 elements of X followed by 600000 elements of Y. However, what happens is gnuplot still reads X1,Y1,X2,Y2...X600000,Y600000. Is there a way to modify the command to read in the original data without reshuffling the bytes?

many thanks,
Maksym

Back to comp.graphics.apps.gnuplot | Previous | Next | Find similar | Unroll thread


Thread

Scatter plot from a binary data maksym.petrenko@gmail.com - 2015-02-20 11:55 -0800

csiph-web