snapGrid | R Documentation |
Use a call to this function as the snap
parameter of overlayServer()
to
enable a simple snap-to-grid behaviour for your overlay. It will ensure your
overlays stay within the bounds of the plot, and snap both position and
width of each overlay to the specified grid.
snapGrid(anchor = 0, step = 1, min_width = NA, max_width = NA)
anchor |
The location of any specific gridline. |
step |
The space between gridlines. |
min_width |
(optional) Minimum width of an overlay; default ( |
max_width |
(optional) Maximum width of an overlay; default ( |
Note that you do not pass just snapGrid
to overlayServer()
, but e.g.
snapGrid()
or snapGrid(step = 0.1)
. The default values snap overlays to
whole numbers.
A snapping function suitable to pass to overlayServer()
as the
snap
argument.
overlayServer()
, for a complete example.
server <- function(input, output) {
ov <- overlayServer("my_plot", 8, snap = snapGrid())
# further server code here . . .
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.