l_plot3D
is a generic function for creating interactive
visualization environments for R objects.
l_plot3D(x, y, z, ...) # S3 method for default l_plot3D( x, y = NULL, z = NULL, axisScaleFactor = 1, by = NULL, on, layout = c("grid", "wrap", "separate"), connectedScales = c("cross", "row", "column", "both", "x", "y", "none"), color = l_getOption("color"), glyph = l_getOption("glyph"), size = l_getOption("size"), active = TRUE, selected = FALSE, xlabel, ylabel, zlabel, title, showLabels = TRUE, showScales = FALSE, showGuides = TRUE, guidelines = l_getOption("guidelines"), guidesBackground = l_getOption("guidesBackground"), foreground = l_getOption("foreground"), background = l_getOption("background"), parent = NULL, ... )
x | the x, y and z arguments provide the x, y and z coordinates for the plot. Any reasonable way of defining the coordinates is acceptable. See the function xyz.coords for details. If supplied separately, they must be of the same length. |
---|---|
y | the y coordinates of points in the plot, optional if x is an appropriate structure. |
z | the z coordinates of points in the plot, optional if x is an appropriate structure. |
... | named arguments to modify plot states. |
axisScaleFactor | the amount to scale the axes at the centre of the rotation. Default is 1. All numerical values are acceptable (0 removes the axes, < 0 inverts the direction of all axes.) |
by | loon plot can be separated by some variables into multiple panels.
This argument can take a |
on | if the |
layout | layout facets as |
connectedScales | Determines how the scales of the facets are to be connected depending
on which
|
color | colours of points; colours are repeated
until matching the number points. Default is found using |
glyph | the visual representation of the point. Argument values can be any of
|
size | size of the symbol (roughly in terms of area).
Default is found using |
active | a logical determining whether points appear or not
(default is |
selected | a logical determining whether points appear selected at first
(default is |
xlabel | Label for the horizontal (x) axis. If missing,
one will be inferred from |
ylabel | Label for the vertical (y) axis. If missing,
one will be inferred from |
zlabel | Label for the third (perpendicular to the screen) (z) axis. If missing,
one will be inferred from |
title | Title for the plot, default is an empty string. |
showLabels | logical to determine whether axes label (and title) should be presented. |
showScales | logical to determine whether numerical scales should be presented on both axes. |
showGuides | logical to determine whether to present background guidelines to help determine locations. |
guidelines | colour of the guidelines shown when |
guidesBackground | colour of the background to the guidelines shown when
|
foreground | foreground colour used by all other drawing.
Default is found using |
background | background colour used for the plot.
Default is found using |
parent | a valid Tk parent widget path. When the parent widget is
specified (i.e. not |
if the argument by
is not set, a loon
widget will be returned;
else an l_facet
object (a list) will be returned and each element is
a loon
widget displaying a subset of interest.
l_help()
function call. The general direct manipulation and interaction gestures are outlined in the following figures.
Rotating
Press 'R' to toggle rotation mode. When rotation mode is active, either use the below mouse gestures or arrow keys to rotate the plot.
The centre of the rotation can be changed by panning the plot. To reset the rotation, use the tripod icon in the plot inspector.
Zooming and Panning
Selecting Points/Objects
Moving Points on the Scatterplot Display
NOTE: Although it is possible to programmatically add layers to an l_plot3D, these will not appear as part of the 3D plot's display. There is no provision at present to incorporate rotation of 3D geometric objects other than point glyphs.
The scatterplot displays a number of direct interactions with the
mouse and keyboard, these include: rotating, zooming towards the mouse cursor using
the mouse wheel, panning by right-click dragging and various selection
methods using the left mouse button such as sweeping, brushing and
individual point selection. See the documentation for l_plot3D
for more details about the interaction gestures.
Turn interactive loon plot static loonGrob
, grid.loon
, plot.loon
.
Other three-dimensional plotting functions:
l_scale3D()
if(interactive()){ with(quakes, l_plot3D(long, lat, depth, linkingGroup = "quakes") ) with(l_scale3D(quakes), l_plot3D(long, lat, depth, linkingGroup = "quakes") ) scaled_quakes <- l_scale3D(quakes) with(scaled_quakes, l_plot3D(long, lat, depth, linkingGroup = "quakes") ) with(scaled_quakes, l_plot3D(mag, stations, depth, linkingGroup = "quakes") ) # Or together: with(scaled_quakes,{ l_plot3D(long, lat, depth, linkingGroup = "quakes") l_plot3D(mag, stations, depth, linkingGroup = "quakes") } ) } if(interactive()){ # default use as scatterplot p1 <- with(quakes, l_plot3D(long, lat, depth) ) p2 <- with(quakes, l_plot3D(mag, stations, depth) ) # link the two plots p1 and p2 l_configure(p1, linkingGroup = "quakes", sync = "push") l_configure(p2, linkingGroup = "quakes", sync = "push") }