6.6 ColorsMost of Pyxplot’s graph plotting and vector graphics commands have settings for specifying colors. A selection of widely-used colors may be specified by name, for example red and blue. However, greater freedom in choice of color is available by passing these commands objects of type color. Several functions are available for making color objects:
In addition, color objects corresponding to all of Pyxplot’s built-in named colors can be found in the colors module. a = colors.red b = rgb(0,0.5,0) box from 0,0 to 3,3 with color a fillcolor b lw 5 Once a color object has been made, various operations are supported. Multiplying or dividing a color by a number changes the brightness of the color. When two colors are compared, brighter colors are greater than darker colors. When two colors are added together, they are additively mixed in RGB space, so that adding red and green together produces yellow. When one color is subtracted from another, the opposite happens, so that yellow minus green is red. The methods available on color objects are listed in Section 13.3.
|