Contract and parameter doc pages

This commit is contained in:
Neil Toronto 2011-10-07 19:09:04 -06:00
parent 50cf71466e
commit c655cd0efb
3 changed files with 72 additions and 21 deletions

View File

@ -33,8 +33,6 @@
'bdiagonal-hatch 'fdiagonal-hatch 'crossdiag-hatch
'horizontal-hatch 'vertical-hatch 'cross-hatch)))
(defcontract plot-font-size/c (and/c real? (>=/c 0)))
(defcontract font-family/c (one-of/c 'default 'decorative 'roman 'script 'swiss
'modern 'symbol 'system))

View File

@ -8,20 +8,43 @@
@section{Convenience Contracts}
@doc-apply[treeof]
@doc-apply[treeof]{
Identifies trees of values that meet the contract @(racket ct).
Used by @(racket plot) and @(racket plot3d) to construct the contract for a tree of @(racket renderer2d?) or @(racket renderer3d?).
}
@section{Appearance Argument Contracts}
@doc-apply[anchor/c]
@doc-apply[anchor/c]{
The contract for @(racket anchor) arguments and parameters, such as @(racket plot-legend-anchor).
}
@doc-apply[color/c]
@doc-apply[plot-color/c]
@doc-apply[plot-pen-style/c]
@doc-apply[plot-brush-style/c]
@doc-apply[font-family/c]
@doc-apply[point-sym/c]
@doc-apply[plot-color/c]{
The contract for @(racket #:color) arguments, and parameters such as @(racket line-color) and @(racket surface-color).
For the meaning of integer colors, see @(racket ->pen-color) and @(racket ->brush-color).
}
@doc-apply[plot-pen-style/c]{
The contract for @(racket #:style) arguments (when they refer to lines), and paramters such as @(racket line-style).
For the meaning of integer pen styles, see @(racket ->pen-style).
}
@doc-apply[plot-brush-style/c]{
The contract for @(racket #:style) arguments (when they refer to fills), and parameters such as @(racket interval-style).
For the meaning of integer brush styles, see @(racket ->brush-style).
}
@doc-apply[font-family/c]{
Identifies legal font family values. See @(racket plot-font-family).
}
@doc-apply[point-sym/c]{
The contract for the @(racket #:sym) arguments in @(racket points) and @(racket points3d), and the parameter @(racket point-sym).
}
@defthing[known-point-symbols (listof symbol?)]{
A list containing the symbols that are valid @(racket points) labels.
A list containing the symbols that are valid @(racket points) symbols.
@interaction[#:eval plot-eval
(require (only-in srfi/13 string-pad-right))
@ -34,8 +57,27 @@ A list containing the symbols that are valid @(racket points) labels.
@section{Appearance Argument Sequence Contracts}
@doc-apply[plot-colors/c]
@doc-apply[plot-pen-styles/c]
@doc-apply[pen-widths/c]
@doc-apply[plot-brush-styles/c]
@doc-apply[alphas/c]
@doc-apply[plot-colors/c]{
The contract for @(racket #:colors) arguments, as in @(racket 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 @(racket color-seq) and @(racket color-seq*) for a demonstration of constructing arguments with this contract.
}
@doc-apply[plot-pen-styles/c]{
Like @(racket plot-colors/c), but for line styles.
}
@doc-apply[pen-widths/c]{
Like @(racket plot-colors/c), but for line widths.
}
@doc-apply[plot-brush-styles/c]{
Like @(racket plot-colors/c), but for fill styles.
}
@doc-apply[alphas/c]{
Like @(racket plot-colors/c), but for opacities.
}

View File

@ -23,16 +23,24 @@ before using @(racket plot) or @(racket plot3d).}
@doc-apply[plot-width]
@doc-apply[plot-height]{The width and height of a plot, in logical drawing units (e.g. pixels for bitmap plots).}
@doc-apply[plot-jpeg-quality]
@doc-apply[plot-ps-interactive?]
@doc-apply[plot-pdf-interactive?]
@doc-apply[plot-jpeg-quality]{
The quality of JPEG images written by @(racket plot-file) and @(racket plot3d-file). See @(method bitmap% save-file).
}
@doc-apply[plot-ps-interactive?]{
If @(racket #t), @(racket plot-file) and @(racket plot3d-file) open a dialog when writing PostScript files. See @(racket post-script-dc%).
}
@doc-apply[plot-pdf-interactive?]{
If @(racket #t), @(racket plot-file) and @(racket plot3d-file) open a dialog when writing PDF files. See @(racket pdf-dc%).
}
@section{Axis Transforms}
@doc-apply[plot-x-transform]
@doc-apply[plot-y-transform]
@doc-apply[plot-z-transform]{
Per-axis, nonlinear transforms. Set these, for example, to plot with log-scale axes.
Per-axis, nonlinear transforms. Set these, for example, to plot with log-scale axes. See @(racket log-transform).
}
@doc-apply[id-transform]{
@ -44,7 +52,7 @@ A log transform. Use this to generate plots with log-scale axes. Any log-scaled
@examples[#:eval plot-eval
(parameterize ([plot-y-transform log-transform])
(plot (function (λ (x) x) 1 2)))
(plot (function (λ (x) x) 0.01 1)))
(parameterize ([plot-x-transform log-transform])
(plot (function (λ (x) x) -1 1)))]
}
@ -66,7 +74,10 @@ The @(racket freq) parameter controls the ``shakiness'' of the transform. At hig
@section{General Appearance}
@doc-apply[plot-foreground]
@doc-apply[plot-background]{The plot foreground and background color. That both are @(racket 0) by default is not a mistake: for foreground colors, @(racket 0) is interpreted as black; for background colors, @(racket 0) is interpreted as white. See @(racket plot-color/c) for details on integer-indexed colors.}
@doc-apply[plot-background]{
The plot foreground and background color.
That both are @(racket 0) by default is not a mistake: for foreground colors, @(racket 0) is interpreted as black; for background colors, @(racket 0) is interpreted as white.
See @(racket ->pen-color) and @(racket ->brush-color) for details on how PLoT interprets integer colors.}
@doc-apply[plot-foreground-alpha]
@doc-apply[plot-background-alpha]{The opacity of the background and foreground colors.}
@doc-apply[plot-font-size]{The font size of the title, axis labels, tick labels, and other labels, in drawing units.}