IUP

Documentation
Login

mglplot Module

Synopsis

Racket

(require iup/mglplot)
CHICKEN (require-extension iup-mglplot)

Plotting support. Initializes the IUP MglPlot library when loaded.

MglPlot Control

(mglplot #:<name> <value> ...) → ihandle?

Creates a plotting canvas.

(mgllabel [title (or/c string? #f) #f] #:<name> <value> ...) → ihandle?

Plotting Functions

(call-with-mglplot [handle ihandle?] [proc (-> ihandle? any)] #:dimension [dimension integer? 2]) → any

Calls the given procedure with the given plotting canvas handle and ensures that the canvas is ready to receive data of the given dimension. Returns whatever the given procedure returns.

(mglplot-add! [handle ihandle?] [x (or/c string? real?)] [y real?] [z (or/c real? #f) #f] [sample-index (or/c integer? #f) #f] [index (or/c integer? #f) #f]) → void?

Adds a sample to the given plotting canvas. Whether x must be a string or a real number depends on the setting of the dimension argument to the call-with-mglplot invocation that created the dataset: One-dimensional data sets can be labeled with strings while two- and three-dimensional data sets consist of numeric tuples.

If sample-index is #f, the sample is appended to the dataset and the call to mglplot-add! must be within the dynamic context of a call to call-with-mglplot.

If sample-index is a number, the sample is inserted into the dataset before the given sample index. The call to mglplot-add! does not have to be within the dynamic context of a call to call-with-mglplot in this case. The dataset to which the new sample should be added may be specified explicitly by its index through the index argument. If the index argument is false, the current dataset of the plotting canvas is used.

Auxiliary Functions

(mglplot-x/y/z->pixel-x/y [handle ihandle?] [x real?] [y real?] [z real? 0.0]) → (values integer? integer?)

Transforms plot coordinates into pixel coordinates.

(mglplot-paint-to [handle ihandle?] [format string?] [file string?] [width integer? 0] [height integer? 0] [dpi real? 0.0]) → void?

Paints the plot's contents into an image file. The format should be either "EPS" or "SVG". If the width, height and resolution are not specified, the same values as for the on-screen representation of the plot are used.