Closed kmanalo closed 7 years ago
I was surprised to find that I needed to calculate base_height if I provided the pair base_aspect_ratio and base_width.
base_height
base_aspect_ratio
base_width
Here is the example I worked with without using a base_aspect_ratio with explicit height and width:
save_plot(label, p, base_height = 6 / 1.618 , base_width = 6)
Instead I wanted to be able to do this:
save_plot(label, p, base_aspect_ratio = 1.618 , base_width = 6)
Finally, I settled on the below, as the presence of NULL for the missing value is necessary, so as not to disrupt the default options logic:
NULL
save_plot(label, p, base_aspect_ratio = 1.618 , base_height = NULL, base_width = 6)
The code logic is set up to be symmetric, so that if two are known the missing one is calculated, so this case should also work:
save_plot(label, p, base_aspect_ratio = 1.618 , base_height = 6, base_width = NULL)
Like above, I have provided two examples in the documentation:
# same as p3 but determine base_height given base_aspect_ratio and base_width p4 <- ggplot(mpg, aes(x = cty, y = hwy, colour = factor(cyl))) + geom_point(size=2.5) save_plot("p4.png", p4, base_height = NULL, base_aspect_ratio = 1.618, base_width = 6) # same as p4 but determine base_width given base_aspect_ratio and base_height p5 <- ggplot(mpg, aes(x = cty, y = hwy, colour = factor(cyl))) + geom_point(size=2.5) save_plot("p5.png", p5, base_height = 6, base_aspect_ratio = 1.618, base_width = NULL)
Roxygen regenerated documentation.
I was surprised to find that I needed to calculate
base_height
if I provided the pairbase_aspect_ratio
andbase_width
.Here is the example I worked with without using a
base_aspect_ratio
with explicit height and width:Instead I wanted to be able to do this:
Finally, I settled on the below, as the presence of
NULL
for the missing value is necessary, so as not to disrupt the default options logic:The code logic is set up to be symmetric, so that if two are known the missing one is calculated, so this case should also work:
Like above, I have provided two examples in the documentation:
Roxygen regenerated documentation.