12_functional_versions: Plotting Functions for Function Objects

Description Usage Arguments Details References See Also Examples

Description

These functions wrap the main plotting functions.
They take a suitable function object, along with xlim/ylim/etc, and compute the x/y/fv/etc values.

Refer to Main Plotting Functions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
plotf_dfield (f, xlim, ylim=xlim, ...)
plotf_bar (f, xlim, ylim=xlim, zlim, ...)

plotf_cfield (f, xlim, ylim=xlim, ..., n=30, nc = max (n, 60), nh=n)
plotf_surface (f, xlim, ylim=xlim, zlim, ..., n=30)

plotf_tricontour (f, ..., n=30)
plotf_trisurface (f, ..., n=30)

plotf_isosurface (f, xlim, ylim=xlim, zlim=xlim, ...,
    nsurfaces=2, fb, fq,
    nested=TRUE, maximal, panel.contours=TRUE,
    base.contours=panel.contours, rear.contours=panel.contours,
    pconstants,
    n)

plotf_cfield3 (f, xlim, ylim=xlim, zlim=xlim, ...,
    nslides=6, z.reverse=FALSE, z, n=30)

plotf_vec (vf, xlim, ylim=xlim, ..., n=20, nv=n, nh = max (n, 40) )
plotf_vec3 (vf, xlim, ylim=xlim, zlim=xlim, ..., n = c (20, 22, 16) )

Arguments

f

In plotf_dfield, plotf_bar, plotf_cfield and plotf_surface, a numeric-valued function of two variables.
In plotf_tricontour and plotf_trisurface, a numeric-valued function of two weight variables, that (along with a third implicit variable) sum to one.
In plotf_isosurface and plotf_cfield3, a numeric-valued function of three variables.

vf

In plotf_vec, a function of two variables that returns a two-column matrix, giving the dx and dy values.
In plotf_vec3, a function of three variables that returns a three-column matrix, giving the dx, dy and dz values.

xlim, ylim, zlim

In plotf_dfield and plotf_bar, a length-two integer vector, giving the plotting ranges.
In other plots, a length-two numeric vector, giving the plotting ranges.
If descending, reverses the orientation of the plot.

Note that in plotf_cfield3, zlim is ignored if z supplied.
And currently, limits need to be ascending for 3d vector fields.

nsurfaces, fb, fq

The number of isosurfaces, and function values (or “levels”), for isosurfaces.
Refer to plot_isosurface for more information.

nested, maximal

nested
Logical value, if true (the default), assume that the isosurfaces are nested.

maximal
Logical value, if true, assume that (nested) isosurfaces are centered around local maxima, if false, assume that they're centered around local minima.

These determine the default fb values, including their order.
(Ascending for low-valued focal points, and descending for high-valued focal points).

The nested argument also determines the default n values.

panel.contours, base.contours, rear.contours

Logical, include contour lines on the base or rear panels of the plot.

pconstants

Optional length-3 numeric vector of panel constants.
Defaults to the midpoints of xlim, ylim and zlim.
Refer to details and examples.

nslides

Integer, the number of slides.
Ignored, if z supplied.

z.reverse

Logical, reverse the z axis.
Ignored, unless z supplied.
(i.e. If z is missing, zlim determines the vertical orientation).

z

Optional numeric vector, of z coordinates.
If supplied, there will be one slide for each z value.

n

In most plots, an integer of length one or two, giving the number of bin/grid points, in each x/y direction. In plotf_isosurface and plotf_vec3d, an integer of length one or three, giving the number of grid points, in each x/y/z direction.

In plotf_isosurface, can also be a list of such vectors, one for each isosurface.

Note, I recommend that the n values for x and y be different, for 3d vector fields.

nc, nv, nh

Same as n, but computes separate input matrices, for contour lines (nc), vector arrows (nv) and heatmaps (nh).

...

Additional arguments for the main plotting functions.

Details

These functions wrap the main plotting functions.
i.e. plotf_isosurface calls plot_isosurface.

They take a suitable function object, along with xlim/ylim/etc, and compute the x/y/fv/etc values.
i.e. plotf_surface takes a numeric-valued function of two variables, a computes the x and y vectors, along with the fv matrix.

If you need to plot different functions to those described by the f argument above, it may be possible to create a wrapper function.

ISOSURFACE PLOTS
(plotf_isosurface)

THIS FUNCTION REQUIRES THE misc3d PACKAGE TO BE INSTALLED AND LOADED
(There's no requirement for the package to be attached).

If the nested argument is true, different n sizes are used for each isosurface.
The resolution of the fv array is highest for the first isosurface, and each fv array has a progressively lower resolution. Resulting plots should result in smaller file sizes, and render more quickly.

Optionally, 2D contour lines may be added to the base panel and rear panels.
This needs a vector of panel constants, which defaults to the xlim/ylim/zlim midpoints.
The function (of three variables), f, is called three times, holding one variable constant, each time.

The third constant is for the base panel contours.
And the first and second constants, are for the right-rear and left-rear panel contours, respectively.

References

Refer to the vignette for an overview, references and better examples.

See Also

Main Plotting Functions

Global Options

litmus, litmus.fit

Predefined Litmus Objects, Predefined Litmus-Fitting Functions
With predefined colors.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
##############################
#functions of two variables
#(discretely-spaced)
##############################
df <- function (x, y, n=10, p=0.5)
    dbinom (x, n, p) * dbinom (y, n, p)

plotf_dfield (df, c (0, 10) )
plotf_bar (df, c (0, 10) )

##############################
#functions of two variables
#(continuously-spaced)
##############################
plotf_cfield (rotated.sinc, c (-15.5, 15.5), fb=0, n=40, hcv=TRUE)
plotf_surface (rotated.sinc, c (-15.5, 15.5), n=40)

##############################
#triangular functions
##############################
tf <- function (w1, w2, w3 = 1 - w1 - w2)
    (w1 - 1 / 3)^2 + (w2 - 1 / 3)^2 + (w3 - 1 / 3)^2

plotf_tricontour (tf, xlab="w1", ylab="w2")
plotf_trisurface (tf, xlab="w1", ylab="w2")

##############################
#functions of three variables
##############################
plotf_isosurface (bispherical.dist, c (-3, 3),, c (-2, 2) )
plotf_cfield3 (bispherical.dist, c (-3, 3),, c (-2, 2), emph="l")

##############################
#vector fields
##############################
plotf_vec (circular.field, c (-1.5, 1.5) )
plotf_vec3 (plughole.field, c (-1.5, 1.5),, c (-0.5, 1) )

barsurf documentation built on Jan. 20, 2021, 5:08 p.m.