SBML2TikZ

Home
Download
About Us
Contact Us
Site Map
Specifying Shades of Colors
Sometimes shapes in a graph are filled with shades of colors instead of a single solid color. The figure below is an example of a rectangle filled with a shading of light blue and white:

Figure 8: a species labeled as 'ATP' and filled with a shading or gradient of blue and white colors

 

PGF/TikZ recognizes a collection of color values and coordinates as a shading value, and is able to interpolate the colors in a shading given any number of 'stop colors' and their positions. For example, in Figure 1, there are two stop colors, light blue with its position on the left, and white, with its position on the right. Here is some sample TeX that initializes and assigns the shading used in Figure 1:

 

\definecolor{color0}{RGB}{204,255,255}; % this defines a pastel blue color

\definecolor{color1}{RGB}{255,255,255}; % this defines a white color

\pgfdeclareverticalshading {LinearGradient_0} { 70pt } {color(0pt)=(color0!100); color(50pt)=(color1!100)} 

 

The above code block defines a shading, 'LinearGradient_0' as an interpolation of colors between 'color0' at 0pts (the coordinates for a line along the bottom of a shading) and 'color1' at 50pts (the coordinates for a line along the top of a shading.) If we were to tell PGF to draw the shading by itself, we would obtain:

 

Figure 9: a pastel blue shading named 'LinearGradient_0'

 

We can use the shading to fill a shape such as the rectangle in Figure 8 by passing the shading as a 'shading' argument to the drawing command for the rectangle. For instance:

 

 \fill[rounded corners = 5pt, shading = LinearGradient_0, shading angle = -90 ] ... ...

 

Would fill the shape following the command with 'LinearGradient_0' rotated by '-90 degrees' anticlockwise (or 90 degrees clockwise; the shading angle argument expects the input to be in the anticlockwise direction.) For simplicity, we did not include the commands to draw the shape that would normally appear where '... ...' appear in the example TeX.

 

Go To Next Page