1
votes

I have a data file of 11 columns. The first column corresponds to time, which I want to take along the y axis. The remaining ones are dynamical variables which I want to plot as a filled color plot. Along the x axis I need the index of columns. How can I do this using gnu plot? (I have 15000 rows)

1
So your plot is going to have 10 vertical bars. Each bar will contain colors. What exactly should be represented by the color? 15000 values is too many to show each row as a separate horizontal color bar. Do you want to average in groups? Convert it into a distribution of value? Something more complicated like a vertical violin plot? - Ethan
Dear Ethan, I am sharing you one link which will show you in general how the plot will look like.google Refer figure(2). - arjun

1 Answers

0
votes

15000 rows is too may to show each value individually. If successive values are smoothly varying, however, we can approximate using a spline fit with a smaller number of segments. The script below shows how you might do this in several steps.

  # create a fake data set with values between -1 and 1 that varies smoothly
  # this is a stand-in for one of your data columns
  set sample 15000
  set xrange [1:15000]
  set table $DATA15000
  plot sin( sqrt( x/3 ) )
  unset table

Fit a 100 segment spline to this data. I had to experiment with the spline weighting (3rd entry in the using specifier) to get a satisfactory result.

  # fit 100 segment spline to the data
  set sample 100
  set table $SPLINE1
  plot $DATA15000 using 1:2:(1.e-7) smooth acsplines
  unset table

Now plot the spline approximation as vertical stack of boxes, one box per sample. Each box is colored by the palette color corresponding to its spline-approximated value. The palette range is auto-scaled to the min/max range of values in spline fit to the artificial data set. Note that even though the "real" data is limited to [-1:1] because it was generated with a sin function, the spline approximation generated values >1 so the auto-scaled range is slightly greater than that.

The boxxyerror plot style uses 7 input specifiers in this case x coordinate (this will be your column number) y coordinate (this will be the time value in column 1 of your original data) xmin (left edge of box) xmax (right edge of box) ymin (bottom of box) ymax (top of box) value (will be mapped through the color palette)

  set palette cubehelix  # my choice of palette colors
  set cbrange noextend   
  ydel = 15000./100.     # height of each box 
  set xrange [0:11]      # room for 10 columns
  set xtics 1 scale 0    # number 1 to 10, no actual tic mark

  plot $SPLINE1 using (1.0):1:(0.6):(1.4):($1):($1+ydel):($2) with boxxyerror fc palette

enter image description here

For your complete plot you would create 10 spline approximations, one for each data column. Plot them all in one plot command after adjusting the xmin/xmax values in the respective using specifiers.