Learn R Programming

grip (version 0.1.2)

project.3d: Project 3D coordinates to 2D for static plotting

Description

Applies a rotation defined by azimuth and elevation angles and returns the first two columns of the rotated matrix.

Usage

project.3d(coords, azimuth = 35, elevation = 22)

Value

A two-column numeric matrix of projected (x, y) coordinates.

Arguments

coords

Numeric matrix with at least 3 columns (only the first 3 are used).

azimuth

Rotation around the vertical axis in degrees. Default 35.

elevation

Rotation around the horizontal axis in degrees. Default 22.

Details

This is the projection used internally by plot.layout when projection = "ortho" and is exported so that users can pre-project coordinates for custom plotting.

Examples

Run this code
edges <- edges.torus(6, 10)
coords3d <- grip(edges, n = max(edges), dim = 3,
                        preset = "torus", seed = 1)
xy <- project.3d(coords3d)
plot(xy, asp = 1, pch = 16, cex = 0.5)

Run the code above in your browser using DataLab