user1743798
user1743798

Reputation: 445

grayscale histogram with gnuplot

I'm new to gnuplot and I want to draw a triple histogram for a set of data of any length. Here is my code but the line set palette gray seems to have no effect -- everything is still in RGB. What am I missing here?

set terminal pdf enhanced
set output 'out.pdf'

set palette gray

set style data histogram
set style histogram cluster gap 1

set style fill solid 1
set auto x
set yrange [0:*]
plot 'in.dat' using 2:xtic(1) title col, \
        '' using 3:xtic(1) title col, \
        '' using 4:xtic(1) title col

Upvotes: 5

Views: 5232

Answers (1)

Christoph
Christoph

Reputation: 48390

The set palette command influences only images, pm3d surfaces and if used explicitely with e.g. linecolor palette.

The terminal option monochrome also doesn't help you, because that sets the color of all lines to black and uses different dash patterns.

You can e.g. redefine the color of the linetypes:

set linetype 1 lc rgb 'black'
set linetype 2 lc rgb '#555555'
set linetype 3 lc rgb '#999999'
plot 'in.dat' u 2:xtic(1) t col, '' u 3 t col, '' u 4 t col

Note, that reset doesn't revert this line type changes. For this you must restart gnuplot.

Alternatively, you could also use set terminal pdf monochrome and set style fill pattern.

Upvotes: 5

Related Questions