On this page:
8.1 Convenience Contracts
treeof
8.2 Appearance Argument Contracts
anchor/ c
color/ c
plot-color/ c
plot-pen-style/ c
plot-brush-style/ c
font-family/ c
point-sym/ c
known-point-symbols
8.3 Appearance Argument Sequence Contracts
plot-colors/ c
plot-pen-styles/ c
pen-widths/ c
plot-brush-styles/ c
alphas/ c
Version: 5.2

8 Plot Contracts

8.1 Convenience Contracts

(treeof ct)  contract?
  ct : (or/c contract? (any/c . -> . any/c))

=

(or/c ct (listof (recursive-contract (treeof ct))))

Identifies trees of values that meet the contract ct. Used by plot and plot3d to construct the contract for a tree of renderer2d? or renderer3d?.

8.2 Appearance Argument Contracts

anchor/c : contract?

=

(one-of/c 'top-left 'top 'top-right
          'left 'center 'right
          'bottom-left 'bottom 'bottom-right)
The contract for anchor arguments and parameters, such as plot-legend-anchor.

color/c : contract?

=

(or/c (list/c real? real? real?)
      string? symbol?
      (is-a?/c color%))

The contract for #:color arguments, and parameters such as line-color and surface-color. For the meaning of integer colors, see ->pen-color and ->brush-color.

plot-pen-style/c : contract?

=

(or/c exact-integer?
      (one-of/c 'transparent 'solid 'dot 'long-dash
                'short-dash 'dot-dash))
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.

plot-brush-style/c : contract?

=

(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.

font-family/c : contract?

=

(one-of/c 'default 'decorative 'roman 'script 'swiss
          'modern 'symbol 'system)
Identifies legal font family values. See plot-font-family.

The contract for the #:sym arguments in points and points3d, and the parameter point-sym.

A list containing the symbols that are valid points symbols.

> (require (only-in srfi/13 string-pad-right))
> (for ([sym  (in-list known-point-symbols)]
        [n    (in-cycle (in-range 3))])
    (display (string-pad-right (format "~v" sym) 22))
    (when (= n 2) (newline)))

'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          

> (length known-point-symbols)

59

8.3 Appearance Argument Sequence Contracts

The contract for #:colors arguments, as in contours. If the contracted value is a function, it is intended to take a list of values, such as contour values, as input, and return a list of colors. The number of colors need not be the same as the number of values. If shorter, they will cycle; if longer, some will not be used.

See color-seq and color-seq* for a demonstration of constructing arguments with this contract.

Like plot-colors/c, but for line styles.

pen-widths/c : contract?

=

(or/c (listof (>=/c 0))
      ((listof real?) . -> . (listof (>=/c 0))))
Like plot-colors/c, but for line widths.

Like plot-colors/c, but for fill styles.

alphas/c : contract?

=

(or/c (listof (real-in 0 1))
      ((listof real?) . -> . (listof (real-in 0 1))))
Like plot-colors/c, but for opacities.