| imed_export_figure | R Documentation |
Export a publication figure
imed_export_figure(
plot,
filename,
width = 180,
height = 120,
units = "mm",
dpi = 600
)
plot |
A 'ggplot' object, for example from 'imed_plot()'. |
filename |
Output file path; the format follows the file extension. |
width |
Figure width in 'units' (default 180). |
height |
Figure height in 'units' (default 120). |
units |
Units for 'width' and 'height' (default '"mm"'). |
dpi |
Resolution in dots per inch (default 600). |
The path 'filename', returned invisibly. The function is called for its side effect of writing the figure to disk.
toy <- data.frame(
Study_ID = paste0("S", 1:12),
Comparability_Class = "CLASS_A",
Reported_Unit = "items/L",
Metric_Type = "Abundance",
Strict_Synthesis_Eligibility = "YES",
Group = rep(c("g1", "g2"), 6),
Mean = c(2.1, 3.4, 1.8, 4.0, 2.9, 3.1, 2.4, 3.8, 1.9, 3.3, 2.7, 4.2),
SD = rep(c(0.6, 0.9), 6),
N = rep(c(10, 12, 8), 4)
)
p <- imed_plot(toy, type = "histogram")
out <- tempfile(fileext = ".png")
imed_export_figure(p, out, width = 90, height = 60, dpi = 100)
file.exists(out)
unlink(out)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.