14 Plot

▼ |  | Mr Lib: Extra GUI Libraries

1 | Aligned Pasteboard
2 | Arrow Toggle Snip
3 | Bitmap Label
4 | Cache-image Snip
5 | Close Icon
6 | Expandable Snip
7 | GIF and Animated GIF Writing
8 | Graphs
9 | Hierarchical List Control
10 | Include Bitmap
11 | Interactive Value Port
12 | Name Message
13 | Path Dialog
14 | Plot
15 | Switchable Button
16 | Image Core
17 | Matrix Snip
18 | Snip Canvases
19 | Syntax Browser
20 | Te X Table
21 | Terminal Window
22 | Acknowledgments
| Index

On this page:

data-set
plot-setup
plot

top ← prev up next →

### 14`` Plot

(require mrlib/plot) | package: gui-lib

The mrlib/plot library provides a simple tool for plotting data values to a device context.

This is an old library, kept only for compatibility. You will undoubtedly want to use the plot library instead, which offers many more features and is actively maintained.

> > struct
> > (struct |  | data-set (points connected? pen min-x max-x min-y max-y)
> #:extra-constructor-name make-data-set)
> points : (listof (is-a?/c point%))
> connected? : any/c
> pen : (is-a?/c pen%)
> min-x : real?
> max-x : real?
> min-y : real?
> max-y : real?

The points field contains the data values to plot, and connected? indicates whether the points are connected by a line. The pen field provides a pen for plotting points/lines. The remaining fields determine the plotting area within a drawing context.

> > struct
> > (struct |  | plot-setup | ( | axis-label-font
> > |  |  |  | axis-number-font
> > |  |  |  | axis-pen
> > |  |  |  | grid?
> > |  |  |  | grid-pen
> > |  |  |  | x-axis-marking
> > |  |  |  | y-axis-marking
> > |  |  |  | x-axis-label
> > |  |  |  | y-axis-label)
> #:extra-constructor-name make-plot-setup)
> axis-label-font : (is-a?/c font%)
> axis-number-font : (is-a?/c font%)
> axis-pen : (is-a?/c pen)
> grid? : any/c
> grid-pen : (is-a?/c pen)
> x-axis-marking : (listof real?)
> y-axis-marking : (listof real?)
> x-axis-label : string?
> y-axis-label : string?

Configures a plot. The grid? field determines whether to draw a grid at axis markings, and the x-axis-marking and y-axis-marking lists supply locations for marks on each axis. The other fields are self-explanatory.

> procedure (plot dc data setup) → void?
> dc : (is-a?/c dc<%>)
> data : (listof data-set?)
> setup : plot-setup?

Draws the data-sets in data into the given dc. Uses drawing-context coordinates in data-sets that will accommodate all of the data sets.
top ← prev up next →