Description Usage Arguments Details Author(s) See Also Examples
Based on a plant constructed with constructplant
, plots the
plant in 3D using the rgl package. Optionally adds the convex hull to the
plot.
See the function crownhull
for details of the convex hull
algorithm.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## S3 method for class 'plant3d'
plot(x, noleaves = FALSE, squarewidth = 250,
addcrownhull = FALSE, hullalpha = 0.4, leaffill = TRUE,
leafoutline = TRUE, stems = TRUE, cylinderstems = stems,
leafcolor = "forestgreen", markleaves = NULL, markcolor = "red",
stemcol = "black", branchcol = "black", petiolecol = "brown",
add = FALSE, shiftxyz = c(0, 0, 0), ...)
## S3 method for class 'plant3dlist'
plot(x, whichrows = NA, png = FALSE, pngsuff = "",
keepopen = !png, windowrect = c(50, 50, 800, 800), squarewidth = 25,
skipexisting = FALSE, addfilename = FALSE, ...)
## S3 method for class 'stand3d'
plot(x, ...)
|
x |
Object of class |
noleaves |
Logical. If TRUE, leaves are not plotted. |
squarewidth |
Width of the square to be plotted at the ground surface. |
addcrownhull |
Logical. If TRUE, a convex hull is added to the plot. |
hullalpha |
Opacity of the convex hull. |
leaffill |
Logical. If TRUE, the default, fills in the leaves. |
leafoutline |
Logical. If TRUE, plots leaf outlines. |
stems |
Logical. If TRUE, plots the stems (black) and branches . |
cylinderstems |
Logical. If TRUE, plots the stems as cylinder sections given the diameter in the plant file. |
leafcolor |
Color of the filled leaves. Can only specify one color. |
markleaves, markcolor |
A vector of leaf numbers to 'mark', using 'markcolor'. |
stemcol, branchcol, petiolecol |
Color of the stems, branches, petioles |
add |
Logical. If TRUE (defaults to FALSE), adds this plant to an existing scene. |
shiftxyz |
Vector of x,y,z coordinates to shift the plant (see Examples). |
whichrows |
Which of the plants in the |
png |
If TRUE, saves a PNG snapshot of every plant plotted. |
pngsuff |
A suffix to add to the filename (defaults to pfile.PNG). |
keepopen |
Whether to keep all windows open. Max number of windows is 10. |
windowrect |
Size of the |
skipexisting |
If PNG=TRUE, whether to skip plants that are already saved to disk. |
addfilename |
If TRUE, places a label of the pfile on the plot (currently poorly placed). |
... |
Further arguments passed to |
Some of the hard work, figuring out the X,Y,Z coordinates of the leaf tip and
leaf sides, is directly taken from the original Yplant Delphi code (in the
non-visible function madeleafdirection
).
Remko Duursma. Robert Pearcy for the Y-plant code.
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 | ## Not run:
# Construct a plant like this:
# myplant <- constructplant("somepfile.p","aleaf.l")
# Standard plot (using built-in sugar maple):
plot(sugarmaple)
# Add a convex hull.
plot(sugarmaple, addcrownhull=TRUE)
# Plot two plants in one scene (second plant is moved 750mm in the x-direction)
plot(sugarmaple)
plot(sugarmaple, shiftxyz=c(750,0,0), add=TRUE)
# Mark the first 10 leaves in red (i.e. first 10 leaves in P file):
plot(sugarmaple, markleaves=1:10)
# Mark all leaves on the plant that have a leaf angle > 45.
plot(toona, markleaves=which(toona$leafdata$ang > 45))
# Plot the stems (and branches) only:
plot(pilularis, noleaves=TRUE)
# Plot many plants.
# First organize a 'leafplantkey', a comma-separated file that links each pfile to an lfile.
# See the online manual for an example, or the help file for 'constructplant'.
myplants <- readplantlist(lpk="leafplantkey.txt")
plot(myplants, png=TRUE, addfilename=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.