5.3.2
10 Plot Contracts
10.1 Plot Element Contracts
Returns 
#t if 
value is a 2D 
renderer; that is, if 
plot can plot 
value.
See 
2D Renderers for functions that construct them.
10.2 Appearance Argument Contracts
| 
 | 
| | = | | (one-of/c 'top-left    'top    'top-right |  | 'left        'center 'right |  | 'bottom-left 'bottom 'bottom-right) | 
 | 
 | 
A contract for very flexible color arguments.
Functions that accept a 
color/c almost always convert it to an RGB triplet using 
->color.
The contract for 
#:style arguments (when they refer to lines), and paramters such as 
line-style.
For the meaning of integer pen styles, see 
->pen-style.
| 
 | 
| | = | | (or/c exact-integer? |  | (one-of/c 'transparent      'solid |  | 'bdiagonal-hatch  'fdiagonal-hatch 'crossdiag-hatch |  | 'horizontal-hatch 'vertical-hatch  'cross-hatch)) | 
 | 
 | 
The contract for 
#:style arguments (when they refer to fills), and parameters such as 
interval-style.
For the meaning of integer brush styles, see 
->brush-style.
| 
 | 
| | = | | (one-of/c 'default 'decorative 'roman  'script 'swiss |  | 'modern  'symbol     'system) | 
 | 
 | 
| 
 | 
| | = | | (list 'dot               'point            'pixel |  | 'plus              'times            'asterisk |  | '5asterisk         'odot             'oplus |  | 'otimes            'oasterisk        'o5asterisk |  | 'circle            'square           'diamond |  | 'triangle          'fullcircle       'fullsquare |  | 'fulldiamond       'fulltriangle     'triangleup |  | 'triangledown      'triangleleft     'triangleright |  | 'fulltriangleup    'fulltriangledown 'fulltriangleleft |  | 'fulltriangleright 'rightarrow       'leftarrow |  | 'uparrow           'downarrow        '4star |  | '5star             '6star            '7star |  | '8star             'full4star        'full5star |  | 'full6star         'full7star        'full8star |  | 'circle1           'circle2          'circle3 |  | 'circle4           'circle5          'circle6 |  | 'circle7           'circle8          'bullet |  | 'fullcircle1       'fullcircle2      'fullcircle3 |  | 'fullcircle4       'fullcircle5      'fullcircle6 |  | 'fullcircle7       'fullcircle8) | 
 | 
 | 
A list containing the symbols that are valid 
points symbols.
10.3 Appearance Argument List Contracts
| 
 | 
| | = | (or/c out-contract (in-contract . -> . out-contract))
 | 
 | 
Returns a contract that accepts either a function from in-contract to out-contract, or a plain out-contract value.
| > (require racket/contract) | 
|  | 
|  | 
|  | 
| > (maybe-function-of-real-consumer 4) | 
| 4 | 
| > (maybe-function-of-real-consumer (λ (x) x)) | 
| 10 | 
Many plot functions, such as contours and isosurfaces3d, optionally take lists of appearance values (such as (listof plot-color/c)) as arguments.
A very flexible argument contract would accept functions that produce lists of appearance values.
For example, contours would accept any f with contract (-> (listof real?) (listof plot-color/c)) for its #:colors argument.
When rendering a contour plot, contours would apply f to a list of the contour z values to get the contour colors.
However, most uses do not need this flexibility.
Therefore, plot’s functions accept either a list of appearance values or a function from a list of appropriate values to a list of appearance values.
The maybe-function/c function constructs contracts for such arguments.
In plot functions, if in-contract is a listof contract, the output list’s length need not be the same as the input list’s length.
If it is shorter, the appearance values will cycle; if longer, the tail will not be used.
If f is a function, applies f to args; otherwise returns f.
This is used inside many renderer-producing plot functions to convert maybe-function/c values to lists of appearance values.
This is equivalent to sending 
(λ _ '(1 2)).
The next example is more sophisticated: it sends a 
function-valued 
(plot-colors/c ivl?) to 
contour-intervals.
The function constructs colors from the values of the contour intervals.