1

The problem for me is how plot (using gnuplot) bars with different styles in a figure so that they can be print.

Take data from http://www.ibm.com/developerworks/aix/library/au-gnuplot/ for example, the data is:

#Disk.txt
hdisk2 420 425 410
hdisk3 700 780 760
hdisk4 450 450 452
hdisk5 680 702 690
hdisk6 320 330 329
hdisk7 530 515 514

    #Gnuplot 

set terminal png truecolor
set output "diskimage.png"
set style data histograms
set style fill solid 1.00 border -1
plot "disk.txt"  using 2:xtic(1) title "Oct-09 data growth(gb)", '' using 3 title "N
ov-09 data growth(gb)", '' using 4 title "Dec-09 data growth(gb)"

The gnuplot script works and bars are labelled with different colours for distinction of three groups. However, once it is print on the paper, the colours are lost and it is hard to distinct bars anymore.

My question is whether the bars can be plot with different style for different groups. E.g., Fill bars for different group with different filled style? enter image description here

shijie xu
  • 1,975
  • 21
  • 52

1 Answers1

1

Use fillstyle pattern to select between different fill patterns for each bar type, and lt -1 (or lc rgb 'black') to use black as line color:

set terminal pngcairo
set output "diskimage.png"
set style data histograms

plot 'Disk.txt' using 2:xtic(1) fs pattern 2 lt -1 title "Oct-09 data growth(gb)",\
     '' using 3 fs pattern 1 lt -1 title "Nov-09 data growth(gb)",\
     '' using 4 fs pattern 4 lt -1 title "Dec-09 data growth(gb)"

enter image description here

See the output of the test command (Gnuplot line types) to check the available fill patterns for the desired output terminal.

Community
  • 1
  • 1
Christoph
  • 47,569
  • 8
  • 87
  • 187