How to change the colour of gnuplot's postscript graphs from yellow
Gnuplot chooses yellow for the sixth colour (color ;) when using the postscipt or pstex terminals. This is very annoying because we can't make another choice. Yellow is not readable on a white background so how to we solve this conundram?
Method 1
We can pursuade gnuplot not to use the yellow style of line, not by changing the style of the line but by avoiding using that style. The command to do this is `plot (whatever) with lines (number)' so we replace the sixth function as demonstrated below.
set term postscript eps enhanced color set key left set output "test.ps" set xrange [0:10] plot x, x+1, x+2, x+3, x+4, x+5 with lines 7, x+6 with lines 8, x+7 with lines 9, x+8 with lines 10
Method 2
We can change the line in the postscipt file to change the colour, you can read the details here: http://t16web.lanl.gov/Kawano/gnuplot/postscript-e.html. We need o change the line that makes the horrible yellow colour from something like this;
/LT5 {PL [4 dl 3 dl 1 dl 3 dl ] 1 1 0 DL} def
to something like this;
/LT5 {PL [4 dl 3 dl 1 dl 3 dl ] 1 0.8 0 DL} def
if we keep a copy of the original file, we can automate the above steps for next time using the programs diff
and patch
usually available on unix systems. Details can be found here: http://www.linuxforums.org/applications/using_diff_and_patch.html.
Using the diff command we can generate a list of the differences between he two files, since the changes we need to make are he same each time we can use his file next time too.
diff -uN file.ps editedfile.ps > patch_gnups.txt
The file we make ill be something like this (I used files called out2.tex and out2.tex.new). patch_gnups.txt
--- out2.tex 2006-08-26 22:56:05.000000000 +0100 +++ out2.tex.new 2006-08-27 21:02:38.798145888 +0100 @@ -62,7 +62,7 @@ /LT2 { PL [2 dl 3 dl] 0 0 1 DL } def /LT3 { PL [1 dl 1.5 dl] 1 0 1 DL } def /LT4 { PL [5 dl 2 dl 1 dl 2 dl] 0 1 1 DL } def -/LT5 { PL [4 dl 3 dl 1 dl 3 dl] 1 1 0 DL } def +/LT5 { PL [4 dl 3 dl 1 dl 3 dl] 1 0.8 0 DL } def /LT6 { PL [2 dl 2 dl 2 dl 4 dl] 0 0 0 DL } def /LT7 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 1 0.3 0 DL } def /LT8 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 0.5 0.5 0.5 DL } def
We can now use the program patch to make the same changes to another file.
patch out.ps <patch_gnups.txt
Now horrible yellow lines should be replaced with orange ones that are a little more visible n gnuplot.