On this page:
8.1 Compatibility
plot-deprecation-warnings?
8.2 Output
plot-new-window?
plot-width
plot-height
plot-jpeg-quality
plot-ps/  pdf-interactive?
8.3 General Appearance
plot-foreground
plot-background
plot-foreground-alpha
plot-background-alpha
plot-font-size
plot-font-family
plot-line-width
plot-legend-anchor
plot-legend-box-alpha
plot-tick-size
plot-title
plot-x-label
plot-y-label
plot-z-label
plot-x-far-label
plot-y-far-label
plot-z-far-label
plot-x-tick-label-anchor
plot-x-tick-label-angle
plot-y-tick-label-anchor
plot-y-tick-label-angle
plot-x-far-tick-label-anchor
plot-x-far-tick-label-angle
plot-y-far-tick-label-anchor
plot-y-far-tick-label-angle
plot-x-axis?
plot-x-far-axis?
plot-y-axis?
plot-y-far-axis?
plot-z-axis?
plot-z-far-axis?
plot-animating?
animated-samples
plot-decorations?
8.4 Lines
line-samples
line-color
line-width
line-style
line-alpha
8.5 Intervals
interval-color
interval-style
interval-line1-color
interval-line1-width
interval-line1-style
interval-line2-color
interval-line2-width
interval-line2-style
interval-alpha
8.6 Points
point-sym
point-color
point-size
point-line-width
point-alpha
8.7 Vector Fields
vector-field-samples
vector-field-color
vector-field-line-width
vector-field-line-style
vector-field-scale
vector-field-alpha
vector-field3d-samples
8.8 Error Bars
error-bar-width
error-bar-color
error-bar-line-width
error-bar-line-style
error-bar-alpha
8.9 Contours and Contour Intervals
default-contour-colors
default-contour-fill-colors
contour-samples
contour-levels
contour-colors
contour-widths
contour-styles
contour-alphas
contour-interval-colors
contour-interval-styles
contour-interval-alphas
8.10 Rectangles
rectangle-color
rectangle-style
rectangle-line-color
rectangle-line-width
rectangle-line-style
rectangle-alpha
rectangle3d-line-width
discrete-histogram-gap
discrete-histogram-skip
discrete-histogram-invert?
stacked-histogram-alphas
stacked-histogram-colors
stacked-histogram-line-colors
stacked-histogram-line-styles
stacked-histogram-line-widths
stacked-histogram-styles
8.11 Decorations
x-axis-alpha
y-axis-alpha
z-axis-alpha
x-axis-far?
y-axis-far?
z-axis-far?
x-axis-ticks?
y-axis-ticks?
z-axis-ticks?
x-axis-labels?
y-axis-labels?
z-axis-labels?
polar-axes-number
polar-axes-alpha
polar-axes-ticks?
polar-axes-labels?
label-anchor
label-angle
label-alpha
label-point-size
8.12 3D General Appearance
plot3d-samples
plot3d-angle
plot3d-altitude
plot3d-ambient-light
plot3d-diffuse-light?
plot3d-specular-light?
8.13 Surfaces
surface-color
surface-style
surface-line-color
surface-line-width
surface-line-style
surface-alpha
8.14 Contour Surfaces
contour-interval-line-colors
contour-interval-line-widths
contour-interval-line-styles
8.15 Isosurfaces
default-isosurface-colors
default-isosurface-line-colors
isosurface-levels
isosurface-colors
isosurface-styles
isosurface-line-colors
isosurface-line-widths
isosurface-line-styles
isosurface-alphas
6.0

8 Plot and Renderer Parameters

 (require plot) package: plot-gui-lib
 (require plot/typed)

8.1 Compatibility

parameter

(plot-deprecation-warnings?)  boolean?

(plot-deprecation-warnings? warnings?)  void?
  warnings? : boolean?

=

#f

When #t, prints a deprecation warning to current-error-port on the first use of mix, line, contour, shade, surface, or a keyword argument of plot or plot3d that exists solely for backward compatibility.

8.2 Output

parameter

(plot-new-window?)  boolean?

(plot-new-window? window?)  void?
  window? : boolean?

=

#f

When #t, plot and plot3d open a new window for each plot instead of returning an image-snip%.

Users of command-line Racket, which cannot display image snips, should enter
before using plot or plot3d.

parameter

(plot-width)  exact-positive-integer?

(plot-width width)  void?
  width : exact-positive-integer?

=

400

parameter

(plot-height)  exact-positive-integer?

(plot-height height)  void?
  height : exact-positive-integer?

=

400

The width and height of a plot, in logical drawing units (e.g. pixels for bitmap plots).

parameter

(plot-jpeg-quality)  (integer-in 0 100)

(plot-jpeg-quality quality)  void?
  quality : (integer-in 0 100)

=

100

The quality of JPEG images written by plot-file and plot3d-file. See save-file.

parameter

(plot-ps/pdf-interactive?)  boolean?

(plot-ps/pdf-interactive? interactive?)  void?
  interactive? : boolean?

=

#f

If #t, plot-file and plot3d-file open a dialog when writing PostScript or PDF files. See post-script-dc% and pdf-dc%.

8.3 General Appearance

parameter

(plot-foreground)  plot-color/c

(plot-foreground color)  void?
  color : plot-color/c

=

0

parameter

(plot-background)  plot-color/c

(plot-background color)  void?
  color : plot-color/c

=

0

The plot foreground and background color. That both are 0 by default is not a mistake: for foreground colors, 0 is interpreted as black; for background colors, 0 is interpreted as white. See ->pen-color and ->brush-color for details on how Plot interprets integer colors.

parameter

(plot-foreground-alpha)  (real-in 0 1)

(plot-foreground-alpha alpha)  void?
  alpha : (real-in 0 1)

=

1

parameter

(plot-background-alpha)  (real-in 0 1)

(plot-background-alpha alpha)  void?
  alpha : (real-in 0 1)

=

1

The opacity of the background and foreground colors.

parameter

(plot-font-size)  (>=/c 0)

(plot-font-size size)  void?
  size : (>=/c 0)

=

11

The font size of the title, axis labels, tick labels, and other labels, in drawing units.

parameter

(plot-font-family)  font-family/c

(plot-font-family family)  void?
  family : font-family/c

=

'roman

The font family used for the title and labels.

parameter

(plot-line-width)  (>=/c 0)

(plot-line-width width)  void?
  width : (>=/c 0)

=

1

The width of axis lines and major tick lines. (Minor tick lines are half this width.)

parameter

(plot-legend-anchor)  anchor/c

(plot-legend-anchor anchor)  void?
  anchor : anchor/c

=

'top-left

Controls the placement of the legend.

parameter

(plot-legend-box-alpha)  (real-in 0 1)

(plot-legend-box-alpha alpha)  void?
  alpha : (real-in 0 1)

=

2/3

The opacity of the filled rectangle behind the legend entries.

parameter

(plot-tick-size)  (>=/c 0)

(plot-tick-size size)  void?
  size : (>=/c 0)

=

10

The length of tick lines, in drawing units.

parameter

(plot-title)  (or/c string? #f)

(plot-title title)  void?
  title : (or/c string? #f)

=

#f

parameter

(plot-x-label)  (or/c string? #f)

(plot-x-label label)  void?
  label : (or/c string? #f)

=

"x axis"

parameter

(plot-y-label)  (or/c string? #f)

(plot-y-label label)  void?
  label : (or/c string? #f)

=

"y axis"

parameter

(plot-z-label)  (or/c string? #f)

(plot-z-label label)  void?
  label : (or/c string? #f)

=

#f

The title and axis labels. A #f value means the label is not drawn and takes no space. A "" value effectively means the label is not drawn, but it takes space.

parameter

(plot-x-far-label)  (or/c string? #f)

(plot-x-far-label label)  void?
  label : (or/c string? #f)

=

#f

parameter

(plot-y-far-label)  (or/c string? #f)

(plot-y-far-label label)  void?
  label : (or/c string? #f)

=

#f

parameter

(plot-z-far-label)  (or/c string? #f)

(plot-z-far-label label)  void?
  label : (or/c string? #f)

=

#f

The axis labels for “far” axes. See plot-x-ticks for a discussion of near and far axes.

parameter

(plot-x-tick-label-anchor)  anchor/c

(plot-x-tick-label-anchor anchor)  void?
  anchor : anchor/c

=

'top

parameter

(plot-x-tick-label-angle)  real?

(plot-x-tick-label-angle angle)  void?
  angle : real?

=

0

parameter

(plot-y-tick-label-anchor)  anchor/c

(plot-y-tick-label-anchor anchor)  void?
  anchor : anchor/c

=

'right

parameter

(plot-y-tick-label-angle)  real?

(plot-y-tick-label-angle angle)  void?
  angle : real?

=

0

parameter

(plot-x-far-tick-label-anchor)  anchor/c

(plot-x-far-tick-label-anchor anchor)  void?
  anchor : anchor/c

=

'bottom

parameter

(plot-x-far-tick-label-angle)  real?

(plot-x-far-tick-label-angle angle)  void?
  angle : real?

=

0

parameter

(plot-y-far-tick-label-anchor)  anchor/c

(plot-y-far-tick-label-anchor anchor)  void?
  anchor : anchor/c

=

'left

parameter

(plot-y-far-tick-label-angle)  real?

(plot-y-far-tick-label-angle angle)  void?
  angle : real?

=

0

Anchor and angles for axis tick labels (2D only). Angles are in degrees. The anchor refers to the part of the label attached to the end of the tick line.

Set these when labels would otherwise overlap; for example, in histograms with long category names.
> (parameterize ([plot-x-tick-label-anchor  'top-right]
                 [plot-x-tick-label-angle   30])
    (plot (discrete-histogram '(#(really-long-category-name-1 2)
                                #(long-category-name-2 1.75)
                                #(long-category-name-3 2.5)))))

image

parameter

(plot-x-axis?)  boolean?

(plot-x-axis? axis?)  void?
  axis? : boolean?

=

#t

parameter

(plot-x-far-axis?)  boolean?

(plot-x-far-axis? axis?)  void?
  axis? : boolean?

=

#t

parameter

(plot-y-axis?)  boolean?

(plot-y-axis? axis?)  void?
  axis? : boolean?

=

#t

parameter

(plot-y-far-axis?)  boolean?

(plot-y-far-axis? axis?)  void?
  axis? : boolean?

=

#t

parameter

(plot-z-axis?)  boolean?

(plot-z-axis? axis?)  void?
  axis? : boolean?

=

#t

parameter

(plot-z-far-axis?)  boolean?

(plot-z-far-axis? axis?)  void?
  axis? : boolean?

=

#t

When any of these is #f, the corresponding axis is not drawn.

Use these along with x-axis and y-axis if you want axes that intersect the origin or some other point.

parameter

(plot-animating?)  boolean?

(plot-animating? animating?)  void?
  animating? : boolean?

=

#f

When #t, certain renderers draw simplified plots to speed up drawing. Plot sets it to #t, for example, when a user is clicking and dragging a 3D plot to rotate it.

procedure

(animated-samples samples)  (and/c exact-integer? (>=/c 2))

  samples : (and/c exact-integer? (>=/c 2))

=

(cond [(plot-animating?)  (max 2 (ceiling (* 1/4 samples)))]
      [else  samples])
Given a number of samples, returns the number of samples to use. This returns samples when plot-animating? is #f.

parameter

(plot-decorations?)  boolean?

(plot-decorations? decorations?)  void?
  decorations? : boolean?

=

#t

When #f, axes, axis labels, ticks, tick labels, and the title are not drawn.

8.4 Lines

parameter

(line-samples)  (and/c exact-integer? (>=/c 2))

(line-samples samples)  void?
  samples : (and/c exact-integer? (>=/c 2))

=

500

parameter

(line-color)  plot-color/c

(line-color color)  void?
  color : plot-color/c

=

1

parameter

(line-width)  (>=/c 0)

(line-width width)  void?
  width : (>=/c 0)

=

1

parameter

(line-style)  plot-pen-style/c

(line-style style)  void?
  style : plot-pen-style/c

=

'solid

parameter

(line-alpha)  (real-in 0 1)

(line-alpha alpha)  void?
  alpha : (real-in 0 1)

=

1

8.5 Intervals

parameter

(interval-color)  plot-color/c

(interval-color color)  void?
  color : plot-color/c

=

3

parameter

(interval-style)  plot-brush-style/c

(interval-style style)  void?
  style : plot-brush-style/c

=

'solid

parameter

(interval-line1-color)  plot-color/c

(interval-line1-color color)  void?
  color : plot-color/c

=

3

parameter

(interval-line1-width)  (>=/c 0)

(interval-line1-width width)  void?
  width : (>=/c 0)

=

1

parameter

(interval-line1-style)  plot-pen-style/c

(interval-line1-style style)  void?
  style : plot-pen-style/c

=

'solid

parameter

(interval-line2-color)  plot-color/c

(interval-line2-color color)  void?
  color : plot-color/c

=

3

parameter

(interval-line2-width)  (>=/c 0)

(interval-line2-width width)  void?
  width : (>=/c 0)

=

1

parameter

(interval-line2-style)  plot-pen-style/c

(interval-line2-style style)  void?
  style : plot-pen-style/c

=

'solid

parameter

(interval-alpha)  (real-in 0 1)

(interval-alpha alpha)  void?
  alpha : (real-in 0 1)

=

3/4

8.6 Points

parameter

(point-sym)  point-sym/c

(point-sym sym)  void?
  sym : point-sym/c

=

'circle

parameter

(point-color)  plot-color/c

(point-color color)  void?
  color : plot-color/c

=

0

parameter

(point-size)  (>=/c 0)

(point-size size)  void?
  size : (>=/c 0)

=

6

parameter

(point-line-width)  (>=/c 0)

(point-line-width width)  void?
  width : (>=/c 0)

=

1

parameter

(point-alpha)  (real-in 0 1)

(point-alpha alpha)  void?
  alpha : (real-in 0 1)

=

1

8.7 Vector Fields

parameter

(vector-field-color)  plot-color/c

(vector-field-color color)  void?
  color : plot-color/c

=

1

parameter

(vector-field-line-width)  (>=/c 0)

(vector-field-line-width width)  void?
  width : (>=/c 0)

=

2/3

parameter

(vector-field-scale)

  (or/c real? (one-of/c 'auto 'normalized))
(vector-field-scale scale)  void?
  scale : (or/c real? (one-of/c 'auto 'normalized))

=

'auto

parameter

(vector-field-alpha)  (real-in 0 1)

(vector-field-alpha alpha)  void?
  alpha : (real-in 0 1)

=

1

parameter

(vector-field3d-samples)  exact-positive-integer?

(vector-field3d-samples samples)  void?
  samples : exact-positive-integer?

=

9

8.8 Error Bars

parameter

(error-bar-width)  (>=/c 0)

(error-bar-width width)  void?
  width : (>=/c 0)

=

6

parameter

(error-bar-color)  plot-color/c

(error-bar-color color)  void?
  color : plot-color/c

=

0

parameter

(error-bar-line-width)  (>=/c 0)

(error-bar-line-width width)  void?
  width : (>=/c 0)

=

1

parameter

(error-bar-line-style)  plot-pen-style/c

(error-bar-line-style style)  void?
  style : plot-pen-style/c

=

'solid

parameter

(error-bar-alpha)  (real-in 0 1)

(error-bar-alpha alpha)  void?
  alpha : (real-in 0 1)

=

2/3

8.9 Contours and Contour Intervals

procedure

(default-contour-colors zs)  (listof plot-color/c)

  zs : (listof real?)

=

(color-seq* (list (->pen-color 5) (->pen-color 0) (->pen-color 1))
            (length zs))

procedure

(default-contour-fill-colors z-ivls)  (listof plot-color/c)

  z-ivls : (listof ivl?)

=

(color-seq* (list (->brush-color 5) (->brush-color 0) (->brush-color 1))
            (length z-ivls))

parameter

(contour-samples)  (and/c exact-integer? (>=/c 2))

(contour-samples samples)  void?
  samples : (and/c exact-integer? (>=/c 2))

=

51

parameter

(contour-levels)

  (or/c 'auto exact-positive-integer? (listof real?))
(contour-levels levels)  void?
  levels : (or/c 'auto exact-positive-integer? (listof real?))

=

'auto

parameter

(contour-widths)  (pen-widths/c (listof real?))

(contour-widths widths)  void?
  widths : (pen-widths/c (listof real?))

=

'(1)

parameter

(contour-styles)  (plot-pen-styles/c (listof real?))

(contour-styles styles)  void?
  styles : (plot-pen-styles/c (listof real?))

=

'(solid long-dash)

parameter

(contour-alphas)  (alphas/c (listof real?))

(contour-alphas alphas)  void?
  alphas : (alphas/c (listof real?))

=

'(1)

parameter

(contour-interval-styles)

  (plot-brush-styles/c (listof ivl?))
(contour-interval-styles styles)  void?
  styles : (plot-brush-styles/c (listof ivl?))

=

'(solid)

parameter

(contour-interval-alphas)  (alphas/c (listof ivl?))

(contour-interval-alphas alphas)  void?
  alphas : (alphas/c (listof ivl?))

=

'(1)

8.10 Rectangles

parameter

(rectangle-color)  plot-color/c

(rectangle-color color)  void?
  color : plot-color/c

=

3

parameter

(rectangle-style)  plot-brush-style/c

(rectangle-style style)  void?
  style : plot-brush-style/c

=

'solid

parameter

(rectangle-line-color)  plot-color/c

(rectangle-line-color color)  void?
  color : plot-color/c

=

3

parameter

(rectangle-line-width)  (>=/c 0)

(rectangle-line-width width)  void?
  width : (>=/c 0)

=

1

parameter

(rectangle-line-style)  plot-pen-style/c

(rectangle-line-style style)  void?
  style : plot-pen-style/c

=

'solid

parameter

(rectangle-alpha)  (real-in 0 1)

(rectangle-alpha alpha)  void?
  alpha : (real-in 0 1)

=

1

parameter

(rectangle3d-line-width)  (>=/c 0)

(rectangle3d-line-width width)  void?
  width : (>=/c 0)

=

1/3

parameter

(discrete-histogram-gap)  (real-in 0 1)

(discrete-histogram-gap gap)  void?
  gap : (real-in 0 1)

=

1/8

parameter

(discrete-histogram-skip)  (>=/c 0)

(discrete-histogram-skip skip)  void?
  skip : (>=/c 0)

=

1

parameter

(discrete-histogram-invert?)  boolean?

(discrete-histogram-invert? invert?)  void?
  invert? : boolean?

=

#f

parameter

(stacked-histogram-alphas)  (alphas/c nat/c)

(stacked-histogram-alphas alphas)  void?
  alphas : (alphas/c nat/c)

=

'(1)

parameter

(stacked-histogram-colors)  (plot-colors/c nat/c)

(stacked-histogram-colors colors)  void?
  colors : (plot-colors/c nat/c)

=

(λ (n) (build-list n add1))

8.11 Decorations

These parameters do not control the typical appearance of plots. Instead, they control the look of renderers that add specific decorations, such as labeled points.

parameter

(x-axis-alpha)  (real-in 0 1)

(x-axis-alpha alpha)  void?
  alpha : (real-in 0 1)

=

1

parameter

(y-axis-alpha)  (real-in 0 1)

(y-axis-alpha alpha)  void?
  alpha : (real-in 0 1)

=

1

parameter

(z-axis-alpha)  (real-in 0 1)

(z-axis-alpha alpha)  void?
  alpha : (real-in 0 1)

=

1

parameter

(x-axis-far?)  boolean?

(x-axis-far? far?)  void?
  far? : boolean?

=

#f

parameter

(y-axis-far?)  boolean?

(y-axis-far? far?)  void?
  far? : boolean?

=

#f

parameter

(z-axis-far?)  boolean?

(z-axis-far? far?)  void?
  far? : boolean?

=

#f

parameter

(x-axis-ticks?)  boolean?

(x-axis-ticks? ticks?)  void?
  ticks? : boolean?

=

#t

parameter

(y-axis-ticks?)  boolean?

(y-axis-ticks? ticks?)  void?
  ticks? : boolean?

=

#t

parameter

(z-axis-ticks?)  boolean?

(z-axis-ticks? ticks?)  void?
  ticks? : boolean?

=

#t

parameter

(x-axis-labels?)  boolean?

(x-axis-labels? labels?)  void?
  labels? : boolean?

=

#f

parameter

(y-axis-labels?)  boolean?

(y-axis-labels? labels?)  void?
  labels? : boolean?

=

#f

parameter

(z-axis-labels?)  boolean?

(z-axis-labels? labels?)  void?
  labels? : boolean?

=

#f

parameter

(polar-axes-alpha)  (real-in 0 1)

(polar-axes-alpha alpha)  void?
  alpha : (real-in 0 1)

=

1/2

parameter

(polar-axes-ticks?)  boolean?

(polar-axes-ticks? ticks?)  void?
  ticks? : boolean?

=

#t

parameter

(polar-axes-labels?)  boolean?

(polar-axes-labels? labels?)  void?
  labels? : boolean?

=

#t

parameter

(label-anchor)  anchor/c

(label-anchor anchor)  void?
  anchor : anchor/c

=

'left

parameter

(label-angle)  real?

(label-angle angle)  void?
  angle : real?

=

0

parameter

(label-alpha)  (real-in 0 1)

(label-alpha alpha)  void?
  alpha : (real-in 0 1)

=

1

parameter

(label-point-size)  (>=/c 0)

(label-point-size size)  void?
  size : (>=/c 0)

=

4

8.12 3D General Appearance

parameter

(plot3d-samples)  (and/c exact-integer? (>=/c 2))

(plot3d-samples samples)  void?
  samples : (and/c exact-integer? (>=/c 2))

=

41

parameter

(plot3d-angle)  real?

(plot3d-angle angle)  void?
  angle : real?

=

30

parameter

(plot3d-altitude)  real?

(plot3d-altitude altitude)  void?
  altitude : real?

=

60

parameter

(plot3d-ambient-light)  (real-in 0 1)

(plot3d-ambient-light light)  void?
  light : (real-in 0 1)

=

2/3

parameter

(plot3d-diffuse-light?)  boolean?

(plot3d-diffuse-light? light?)  void?
  light? : boolean?

=

#t

parameter

(plot3d-specular-light?)  boolean?

(plot3d-specular-light? light?)  void?
  light? : boolean?

=

#t

8.13 Surfaces

parameter

(surface-color)  plot-color/c

(surface-color color)  void?
  color : plot-color/c

=

0

parameter

(surface-style)  plot-brush-style/c

(surface-style style)  void?
  style : plot-brush-style/c

=

'solid

parameter

(surface-line-color)  plot-color/c

(surface-line-color color)  void?
  color : plot-color/c

=

0

parameter

(surface-line-width)  (>=/c 0)

(surface-line-width width)  void?
  width : (>=/c 0)

=

1/3

parameter

(surface-line-style)  plot-pen-style/c

(surface-line-style style)  void?
  style : plot-pen-style/c

=

'solid

parameter

(surface-alpha)  (real-in 0 1)

(surface-alpha alpha)  void?
  alpha : (real-in 0 1)

=

1

8.14 Contour Surfaces

Contour surface renderers use shared contour parameters except for the following three.

parameter

(contour-interval-line-widths)  (pen-widths/c (listof ivl?))

(contour-interval-line-widths widths)  void?
  widths : (pen-widths/c (listof ivl?))

=

'(1/3)

8.15 Isosurfaces

Single isosurfaces (isosurface3d) use surface parameters. Nested isosurfaces (isosurfaces3d) use the following.

procedure

(default-isosurface-colors zs)  (listof plot-color/c)

  zs : (listof real?)

=

(color-seq* (list (->brush-color 5) (->brush-color 0) (->brush-color 1))
            (length zs))

procedure

(default-isosurface-line-colors zs)  (listof plot-color/c)

  zs : (listof real?)

=

(color-seq* (list (->pen-color 5) (->pen-color 0) (->pen-color 1))
            (length zs))

parameter

(isosurface-levels)

  (or/c 'auto exact-positive-integer? (listof real?))
(isosurface-levels levels)  void?
  levels : (or/c 'auto exact-positive-integer? (listof real?))

=

'auto

parameter

(isosurface-styles)  (plot-brush-styles/c (listof real?))

(isosurface-styles styles)  void?
  styles : (plot-brush-styles/c (listof real?))

=

'(solid)

parameter

(isosurface-line-widths)  (pen-widths/c (listof real?))

(isosurface-line-widths widths)  void?
  widths : (pen-widths/c (listof real?))

=

'(1/3)

parameter

(isosurface-line-styles)  (plot-pen-styles/c (listof real?))

(isosurface-line-styles styles)  void?
  styles : (plot-pen-styles/c (listof real?))

=

'(solid)

parameter

(isosurface-alphas)  (alphas/c (listof real?))

(isosurface-alphas alphas)  void?
  alphas : (alphas/c (listof real?))

=

'(1/2)