gnuplot / postscript (E)
not so FAQ |
After Plotting (No.3)How do I change colors in a PostScript figure ? You cannot specify colors of lines and symbols directly from Here is a tricky way to change the colors. Edit the postscript file gnuplot> set term postscript enhanced color gnuplot> set output "colorindex.ps" gnuplot> set size 0.5,0.5 gnuplot> set noborder gnuplot> set nokey gnuplot> set linestyle 1 linetype 1 linewidth 8 gnuplot> set linestyle 2 linetype 2 linewidth 8 gnuplot> set linestyle 3 linetype 3 linewidth 8 gnuplot> set linestyle 4 linetype 4 linewidth 8 gnuplot> set linestyle 5 linetype 5 linewidth 8 gnuplot> set linestyle 6 linetype 6 linewidth 8 gnuplot> set linestyle 7 linetype 7 linewidth 8 gnuplot> set linestyle 8 linetype 8 linewidth 8 gnuplot> set linestyle 9 linetype 9 linewidth 8 gnuplot> set linestyle 10 linetype 10 linewidth 8 gnuplot> # for gnuplot ver.4 gnuplot> # set style line 1 line type 1 linewidth 8 gnuplot> # ... etc gnuplot> set noxtics gnuplot> set ytics nomirror 1 gnuplot> set yrange [ -1.5 : 10.5 ] gnuplot> plot 1 w l ls 1, 2 w l ls 2, 3 w l ls 3, 4 w l ls 4, gnuplot> 5 w l ls 5, 6 w l ls 6, 7 w l ls 7, 8 w l ls 8, gnuplot> 9 w l ls 9, 10 w l ls 10, -1 w line -1, 0 with line 0 gnuplot> pause -1 Ten line types are defined in the PostScript terminal, those are Do the same thing but with a B/W PostScript. Remove the color Lets read the PS file generated above, you can easily find the place /LT0 {PL [ ] 1 0 0 DL} def /LT1 {PL [4 dl 2 dl ] 0 1 0 DL} def /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 /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 Those lines correspond to the line types 1 to 9. Three numbers in To make a gradation from red to yellow, fix the R=1 and Blue=0, and /LT0 {PL [ ] 1 0 0 DL} def /LT1 {PL [4 dl 2 dl ] 1 0.1 0 DL} def /LT2 {PL [2 dl 3 dl ] 1 0.2 0 DL} def /LT3 {PL [1 dl 1.5 dl ] 1 0.3 0 DL} def /LT4 {PL [5 dl 2 dl 1 dl 2 dl ] 1 0.4 0 DL} def /LT5 {PL [4 dl 3 dl 1 dl 3 dl ] 1 0.5 0 DL} def /LT6 {PL [2 dl 2 dl 2 dl 4 dl ] 1 0.6 0 DL} def /LT7 {PL [2 dl 2 dl 2 dl 2 dl 2 dl 4 dl ] 1 0.7 0 DL} def /LT8 {PL [2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 1 0.8 0 DL} def The results are as follows. The first image is generated with gnuplot,
Now, go back to the postscript data above, you can see “[4 dl 2 dl]” In the PS file you can find the following 2 lines, those are just above /LTb { BL [] 0 0 0 DL } def /LTa { AL [1 dl 2 dl] 0 setdash 0 0 0 setrgbcolor } def The line LTb is used for the border of graph, and LTa is for the zero axes. I want to get rid of a right-side margin in a square figure.A square figure can be drawn by set size square . However, %%BoundingBox: 50 50 410 302 This “410” is too large in this case, then reduce it. An If you are working on Unix or Linux, and your system has % eps2eps input.eps output.eps from Russell in Universiteit van Amsterdam. Thanks !
|