Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: James Waldby Newsgroups: comp.graphics.apps.gnuplot Subject: Re: help with reformatting the data file to generate a heatmap gnu plot. Date: Sun, 7 Aug 2011 16:51:55 +0000 (UTC) Organization: A noiseless patient Spider Lines: 52 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 7 Aug 2011 16:51:55 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="OAvC6XS0NcIQcGJcjYhOHA"; logging-data="16965"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/PXyLWl5sBLCsJS7EStHyS" User-Agent: Pan/0.133 (House of Butterflies) Cancel-Lock: sha1:DmaV7FBvQ9S/ovranaioLzggPlI= Xref: x330-a1.tempe.blueboxinc.net comp.graphics.apps.gnuplot:524 On Tue, 02 Aug 2011 15:34:07 -0700, anky wrote: > So i have file that looks like this: > > 2011-06-21 17:44:46.530931 21258 23073 23953 24130 [snip 114 numbers] > ... 45000 65535 > > this is 1 row of the file with 124 values. The next row will have a new > timestamp and corresponding 124 values. i want to make a heatmap which > plots them in 10*12 matrix which means, i just use the first 120 values. > I want to do something like this > http://gnuplot.sourceforge.net/demo_4.2/heatmaps.html ( 1st example) . > In my case the 120 values correspond to color intensity it would show. > The problem is i will read these values from an external file and i > need to reformat this in form of a matrix to generate a heatmap like the > one shown in example. > > This is my first time using gnuplots and i dont have much idea about it. > Is there way that i can read these in as strings and then format them as > a 10*12 matrix ?? You might need to reformat the data externally. For example, awk -vL=1 -vb=3 -ve=123 -vk=10 'NR==L {for(i=b;i data.out after the name of the input file, which is data.file in this example. Here's an example of bash commands that will process lines 1 to 13 from input file 'data.file' and produce output data files 'out1' ... 'out13' : for m in {1..13}; do awk -vL=$m -vb=3 -ve=123 -vk=10 'NR==L {for(i=b;i out$m; done -- jiw