Description Usage Arguments Value Shape scaling
Converts a vector of coordinate points to a data object that can be drawn
with polygon
. It calculate the values need to plot the points
as polygons specified by shape. Currently only triangles pointing up and
triangles pointing down can be specified. Each point can be described
separately by passing in a vector for the shapes
parameter. Other than
x and y coordinates of the points to plot and the two scale paramters,
provided values will be wrapped as needed.
1 2 3 | pointToPoly(x, y, widths = 20, heights = 20, shapes = "triangleDown",
sides = 5, fillColors = "red", borderColors = "black", scale = c(4,
1), resScale = c(1, 1))
|
x |
The x plot coordinates where the the poly-points should be drawn |
y |
The y plot coordinates where the the poly-points should be drawn |
widths |
The widths in plot coordinates of the poly-points. Default = 5. |
heights |
The height in plot coordinates of the poly-points. Default = 5. |
shapes |
The shape of the poly-point. Allowed shapes are
|
sides |
The position of the poly-points over the coordinate point. Can have a value from 1-9, oriented like a 3 x 3 touch pad, 1 has uper left corner of poly as the point, 5 has the middle over the point, and 9 has the lower right as the point. Default = 5, centered. |
fillColors |
The colors filling the poly-point. Default = |
borderColors |
The colors of the poly-point borders. Default =
|
scale |
The scale factor of the x and y axis of the plot, i.e if plot
is 100x500, scale should be |
resScale |
The scale factor of the device, i.e. if the screen
resolution is 1024x768, this should be |
Returns a list with the data needed to plot the points as polygons. The elements of the list are:
count | number of points plotted as polygons |
xRadii | 1/2 widths of points, after wrapping |
yRadii | 1/2 heights of points, after wrapping |
shapes | The shapes parameter, after wrapping |
sides | The sides parameter, after wrapping |
fillColors | The fillColors parameter, after wrapping |
borderColors | The borderColors parameter, after wrapping |
x | X coordinates of polygons to draw, NA separated |
y | Y coordinates of polygons to draw, NA separated |
xRange | lowest and highest x value drawn |
yRange | lowest and highest y values drawn |
The shape of a pixel is not necessarily square, so a square of 10 x 10
pixels may not be square but instead rectangular. To make the polygon
shapes come out symetrical, the relative heights and widths of the pixels
must be specified. This is the purpose of the scale
and
resScale
parameters. Two parameters are provided to allow specifying
the plot scaling ratio and the screen resolution scaling ratio separately.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.