Maemo "optification" was added
[gnuplot] / demo / rainbow.dem
1 #
2 # Demonstrate use of pm3d palette colors for 2D plots
3 # terminal-independent color choices
4 #
5 reset
6 #
7 set title "Terminal-independent RGB colors in 2D"
8 set xlabel "Implemented using built-in rgb color names\n(only works for terminals that can do full rgb color)"
9 #
10 set xrange [-0.5:3.5]
11 set yrange [-1:1.4]
12 set bmargin 7
13 unset ytics
14 unset xtics
15 #
16 # define line styles using explicit rgbcolor names
17 #
18 set style line 1 lt rgb "red" lw 3
19 set style line 2 lt rgb "orange" lw 2
20 set style line 3 lt rgb "yellow" lw 3
21 set style line 4 lt rgb "green" lw 2
22 set style line 5 lt rgb "cyan" lw 3
23 set style line 6 lt rgb "blue" lw 2
24 set style line 7 lt rgb "violet" lw 3
25 #
26 set label 1 'set style line 1 lt rgb "red" lw 3'    at -0.4, -0.25 tc rgb "red"
27 set label 2 'set style line 2 lt rgb "orange" lw 2' at -0.4, -0.35 tc rgb "orange"
28 set label 3 'set style line 3 lt rgb "yellow" lw 3' at -0.4, -0.45 tc rgb "yellow"
29 set label 4 'set style line 4 lt rgb "green" lw 2'  at -0.4, -0.55 tc rgb "green"
30 set label 5 'set style line 5 lt rgb "cyan" lw 3'   at -0.4, -0.65 tc rgb "cyan"
31 set label 6 'set style line 6 lt rgb "blue" lw 2'   at -0.4, -0.75 tc rgb "blue"
32 set label 7 'set style line 7 lt rgb "violet" lw 3' at -0.4, -0.85 tc rgb "violet"
33 #
34 print ''
35 print '# These are the input commands'
36 print ''
37 print ' set style line 1 lt rgb "red" lw 3'
38 print ' set style line 2 lt rgb "orange" lw 2'
39 print ' set style line 3 lt rgb "yellow" lw 3'
40 print ' set style line 4 lt rgb "green" lw 2'
41 print ' set style line 5 lt rgb "cyan" lw 3'
42 print ' set style line 6 lt rgb "blue" lw 2'
43 print ' set style line 7 lt rgb "violet" lw 3'
44 print ''
45 print '# And this is the result'
46 #
47 show style line
48 #
49 # draw some plots
50 #
51 plot cos(x)     ls 1 title 'red',   \
52      cos(x-.2)  ls 2 title 'orange',\
53      cos(x-.4)  ls 3 title 'yellow',\
54      cos(x-.6)  ls 4 title 'green', \
55      cos(x-.8)  ls 5 title 'cyan',  \
56      cos(x-1.)  ls 6 title 'blue',  \
57      cos(x-1.2) ls 7 title 'violet'
58 #
59 pause -1 "Hit return to continue"
60
61 if ((GPVAL_VERSION == 4.1 || GPVAL_VERSION == 4.2) \
62 &&  (!strstrt(GPVAL_COMPILE_OPTIONS,"+MACROS"))) \
63     print ">>> Skipping demo <<<\n" ; \
64     print "This copy of gnuplot was built without support for macro substitution\n" ; \
65     exit ;
66
67
68 set title "Terminal-independent palette colors in 2D\nImplemented using command line macros referring to a fixed HSV palette"
69 set colorbox horizontal user origin .1,.08 size .8,.05
70 set xlabel 'HSV color wheel'
71 #
72 unset label 1
73 unset label 2
74 unset label 3
75 unset label 4
76 unset label 5
77 unset label 6
78 unset label 7
79 #
80 # Load terminal-independent colorwheel (HSV full saturation)
81 #
82 load 'colorwheel.dem'
83 #
84 # define line styles using macros and a fixed palette
85 #
86 set style line 1 @red lw 3
87 set style line 2 @orange lw 2
88 set style line 3 @yellow lw 3
89 set style line 4 @green lw 2
90 set style line 5 @cyan lw 3
91 set style line 6 @blue lw 2
92 set style line 7 @violet lw 3
93
94 replot
95
96 pause -1 "Hit return to continue"
97
98 reset