gg_zoom | R Documentation |
]
This function takes an input ggplot2
object and will situate the original side-by-side with the same style plot with a user-defined subset of observations. The effect is that the original plot will be "zoomed" in on specific points.
gg_zoom( .plot, zoom_cmd, draw_box = TRUE, box_nudge = 1, to_label = FALSE, label )
.plot |
|
zoom_cmd |
Expression to return a logical value that, if |
draw_box |
Boolean indicating whether or not to try to draw a rectangle around the subset being zoomed in on for the plot. Default is |
box_nudge |
Coordinates to offset box if |
to_label |
Boolean indicating whether or not the plot should try to label points. Default is |
label |
Bare name of the column used to label the data points if |
NOTE: The "zoomed" in plot will be autoscaled based on the values returned, so it may not match the scale of the original. Interpret with caution.
A patchwork object with the ggplot2
plot and the "zoomed" version side-by-side. The returned object can be further customized using functions from patchwork
including plot_layout.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.