coord_aspect | R Documentation |
Uses a given aspect ratio for a ggplot based on the limits provided.
coord_aspect(ratio = 1, xlim = NULL, ylim = NULL, expand = FALSE, clip = "on")
ratio |
Numeric ratio, default 1 (for square). Ratios should be of the form height / width. |
xlim |
Numeric vector of length 2, limits for x axis |
ylim |
Numeric vector of length 2, limits for y axis |
expand |
Logical, default FALSE, whether to expand |
clip |
Whether to clip to plot, default "on" |
If the range of X values is 10 to 200 and the range of Y values is 20 to 60, then a square aspect ratio would require a ratio of (200 - 10) / (60 - 40). A landscape 16:9 aspect ratio would be (9/16) * (200-10) / (60-40). This is an annoying amount of things to type out if you're fiddling around with the limits and aspect ratio.
coordinate ggproto
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.