graphics - Change "fill style" or "line style" in Gnuplot automatically -


i need plot grid. each segment of grid can have different color /style. style correspond value specified in file. thought boxxyerrorbars style can relevant. created file has 7 columns:

#x  y   xlow  xhi  ylow yhi  style  1   1   0.9   1.1  0.5  1.5   0.2 2   1   1.9   2.1  0.5  1.5   0.4 3   1   2.9   3.1  0.5  1.5   0.6 

i make plot using boxxyerrorbars style , first 6 columns data:

plot[0:4][0:2] 'aa1.dat' w boxxy fs solid 0.6 nobo  

the plot (just 3 segments of grid) looks as... (don't have enough reputations submit image).

all segments drawn style solid 0.6. changing number, 1 can change fill style density. need each segment has own style, example, specified in 7th column of data. maybe, there other ways. need segments drawn style /color, specified file (not inserted hand script).

add palette option plot

the palette option automatically assign color value current palette according value of last column of datafile (in case 7th column, in ordinary function plots 3rd).

plot ... palette 

adjust palette needs

before plotting should set gnuplot palette colors like. use set palette , set cbrange purpose.

example

set palette model rgb defined ( 0 "white", 1 "red")   set cbrange[0:1] unset colorbox plot[0:4][0:2] 'data.txt' w boxxy fs solid  palette 

plot result

explanation

  • in first line set colorpalette go white red.
  • set cbrange[0:1] defines range of palette, i.e. 0 pure white , 1 red (if not set own cbrange gnuplot take min/max values data)
  • unset colorbox tells gnuplot not draw colorbox label next plot

further adjustments

you can adjust colorpalette have descrete color values (i.e. not gradients).

e.g. set palette model rgb defined (0 "blue", 1 "blue", 1 "dark-green", 2 "dark-green", 2 "red", 3 "red" ) set cbrange [1:3]

setting values in style column of file 1,2 or 3 give blue, green or red color, respectively.

#x  y   xlow  xhi  ylow yhi  style  1   1   0.9   1.1  0.5  1.5   1 2   1   1.9   2.1  0.5  1.5   2 3   1   2.9   3.1  0.5  1.5   3 

plot alternative palette


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -