as_figure | R Documentation |
Bundles a ggplot/cowplot graphic, file reference, the final rendered graphic dimensions and markdown references in one figure object.
as_figure(x, ...)
## S3 method for class 'ggplot'
as_figure(
x,
label,
w,
h,
unit = c("mm", "cm", "in"),
ref_name = NULL,
caption = NULL,
legend_text = NULL,
...
)
x |
a ggplot/cowplot object |
... |
extra arguments, currently none. |
label |
the final file name |
w |
the final width after saving/rendering |
h |
the final height after saving/rendering |
unit |
the unit of h and w, mm be default |
ref_name |
optional, name of the reference to the figure, used mainly in markdown documents. |
caption |
optional, text to be presented in the figure caption. |
legend_text |
optional, text to be presented in the extended figure legend. |
ref_name: needs to be a valid markdown/bookdown reference name. By default, spaces, slashes and underscores are silently turned into '-'.
An object of class figure
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.