Description Usage Arguments Value Note Examples
This function takes a plot that is not oriented at true North/South and rotates it to be correct.
1 2 | rotatePlot(df, origin = c(0, 0), rnd = 2, truesw = c(0, 0),
method = "plotcorner", returntruesw = FALSE, manualconversion = 0)
|
df |
A data.frame containing an "x" and a "y" column, representing coordinates. Other information about the data.frame (extra columns) should be retained. |
origin |
A vector of two numbers representing the desired (x,y) coordinates of the desired origin of the resulting dataframe. This defaults to 0,0, meaning that the left/bottom-most point will be at (0,0) |
rnd |
A rounding value, defaults to 0, for the new (x,y) coordinates. |
truesw |
The most southwestern point of the plot, even if it is farther out than any of the trees. |
method |
The method to calculate the plot rotation. Accepts "bottomleft", "topright", and "plotcorner"; see Note for details. |
returntruesw |
If set to true, this function will return the "truesw" points, converted to the new plot space, instead of the entire data.frame. |
manualconversion |
Defaults to 0; you can set this to a manual value to add to the plot conversion, if there are issues with the default options. |
This function returns the data.frame from "x", with modified x and y columns.
This function has a few different ways to rotate the plot. The default method, "plot corner", takes the "truesw" value and uses that as the first point to get rotation angle, with the bottommost point as the second point. The "bottomleft" method takes the rotation angle from the angle between the leftmost point and the bottommost point. The "topright" method takes the rotation angle from the angle between the topmost and rightmost point.
1 | rotatePlot(data.frame(x=c(0,4), y=c(0,-3), stringsAsFactors=FALSE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.