getBoxplot | R Documentation |
Given a Grid1d class object and a matrix or dataframe of points, it returns a dataframe with original points and a supplementary column which groups the y points that fall in the same vertical strip.
getBoxplot(grid, points)
grid |
Grid1d object, made with makeGrid1d function |
points |
2d matrix or dataframe of points |
A dataframe with three columns: xbp (x relative to boxplot), x and y (original points)
# 1. Generate random points on a plane
df_points <- data.frame(
x = c(rnorm(n = 50000, mean = -2), rnorm(n = 50000, mean = 2)),
y = c(rnorm(n = 50000, mean = 1), rnorm(n = 50000, mean = -1))
)
# 2. Define a grid that contains all the points generated along x
stripes <- makeGrid1d(
xmin = floor(min(df_points$x)), xmax = ceiling(max(df_points$x)), xcell = 50
)
# 3. Obtain boxplot dataframe
df_boxplot <- getBoxplot(stripes, df_points)
head(df_boxplot)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.