Description Usage Arguments Details Value Examples
Convert canvas coordinates to the data coordinates
1 | cartesian_to_xy(x, y, track_index = current_track_index())
|
x |
X-locations of the data points in canvas coordinates. |
y |
Y-locations of the data points in canvas coordinates. |
track_index |
Index of the track. |
The data points are assigned to the nearest inner loops. Denote the a data point has a coordinate (r, theta) in the polar coordinate system, r_k and r_k+1 are the radius of the two loops at theta + 2*pi*a and theta + 2*pi*(a+1) that below and above the data point, the data point is assigned to the loop k.
A data frame with two columns: x and y.
1 2 3 4 5 6 7 8 9 | x = runif(100, -5, 5)
y = runif(100, -5, 5)
spiral_initialize()
spiral_track()
df = cartesian_to_xy(x, y)
# directly draw in the viewport
grid.points(x, y, default.units="native")
# check whether the converted xy are correct (should overlap to the previous points)
spiral_points(df$x, df$y, pch = 16)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.