Sunday, August 12, 2007

Gnuplot to plot partial data

gnuplot> plot 'graphs' every ::1:6:4096:6 u 1:2 w l
This command plots the sixth block of data in data file 'graphs' from line 1 to line 4096; using 1:2 with line.

Definition of data block: Data blocks are separated by a single blank line in data file.
For example:
=================

abcde |----> #0 block

12345 |----> #1 block
12345 |
12345 |

abcde |----> #2 block

12345 |----> #3 block
12345 |
12345 |

abcde |----> #4 block

abcde |----> #5 block

12345 |----> #6 block
12345 |
12345 |

abcde |----> #7 block
=================
********************** The following comes from lanl.gov **********************

To specify a range of the data to be plotted, use the every option in the plot command. To skip every two lines, say plot "test.dat" every 2

When the data file contains several data blocks those are separated by a single blank line, you can skip the data block by the every option. To skip every two block, try plot "test.dat" every :2

every I:J:K:L:M:N
I Line increment
J Data block increment
K The first line
L The first data block
M The last line
N The last data block
every 2 plot every 2 line
every ::3 skip the first 3 lines
every ::3::5 plot from the 4-th to 6-th lines
every ::0::0 plot the first line only
every 2::::6 plot the 1,3,5,7-th lines
every :2 plot every 2 data block
every :::5::8 plot from 5-th to 8-th data blocks

Alternatively (if you are on the UNIX-like system), a part of your data file can be plotted by using the unix commands, "head" and "tail".

No comments: