fig_start | R Documentation |
Creates a PDF or PNG figure with dimensions that default approximately to a single column on a two-column paper, bolds text, reduces space between labels and the figure, and sets other improved defaults for margins. The goal is to create publication- and presentation-quality figures with few keystrokes. PNG version is by default high resolution (600 ppi) and scales dimensions according to this resolution to get images that match their PDF counterparts as much as possible.
fig_start(
name,
width = 3,
height = 3,
bg = "white",
mar_b = 3,
mar_l = 3,
mar_t = 0,
mar_r = 0,
mar = NULL,
mar_pad = 0.2,
png = FALSE,
png_res = 600,
verbose = TRUE
)
name |
The output path, excluding extension ( |
width |
Figure width, in inches (default 3).
If |
height |
Figure height, in inches (default 3).
If |
bg |
Figure background color (default "white") |
mar_b |
Bottom margin size, in margin lines (default 3).
|
mar_l |
Left margin size, in margin lines (default 3).
|
mar_t |
Top margin size, in margin lines (default 0).
|
mar_r |
Right margin size, in margin lines (default 0).
|
mar |
A vector with four elements (in the format |
mar_pad |
Margin padding applied to all margins. |
png |
If |
png_res |
Resolution of PNG image in ppi.
In addition to setting the resolution internally in the file, this scales the |
verbose |
If The PDF or PNG is created via |
### simple square figure with nice margins
# fig_start('my_plot')
# plot(1:10)
# fig_end()
### example with a title
### increase top margin only
# fig_start('my_plot', mar_t = 1.5)
# plot(1:10, main = 'My Title!')
# fig_end()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.