setFplot_page | R Documentation |
Tha package fplot
offers some functions (e.g. pdf_fit
or png_fit
) to export figures, with a guarantee to obtain
the desired point size for the plotting text. The function setFplot_page
sets the target page size (once and for all). This is important for the accuracy
of the export, although the default values should be working well most of the time.
setFplot_page(
page = "us",
margins = "normal",
units = "tw",
pt = 10,
w2h = 1.75,
reset = FALSE
)
getFplot_page()
page |
What is the page size of the document? Can be equal to "us" (for
US letter, the default) or "a4". Can also be a numeric vector of length 2 giving
the width and the height of the page in inches. Or can be a character string
of the type: |
margins |
The bottom/left/top/right margins of the page. This is used to obtain the dimension of the body of the text. Can be equal to "normal" (default, which corresponds to 2cm/2.5cm/2cm/2.5cm), or to "thin" (1.5/1/1/1cm). Can be a numeric vector of length 1: then all margins are the same given size in inches. Can also be a numeric vector of length 2 or 4: 2 means first bottom/top margins,
then left/right margins; 4 is bottom/left/top/right margins, in inches. Last,
it can be a character vector of the type |
units |
The default units when using the functions |
pt |
The size of the text, in pt, once the figure is inserted in your final document.
The default is 10. This means that all text appearing in the plot with |
w2h |
Numeric scalar. Used to determine the height of the figure based on
the width. By default it is equal to |
reset |
Logical, default is |
This function sets the option "fplot_export_opts" after parsing the arguments.
This option is then automatically accessed by the functions used to export graphs
export_graph_start()
.
The function setFplot_page()
does not return anything. It sets an
R option containing the page parameters.
The function getFplot_page()
returns the named list of page parameters which has been set
in setFplot_page()
.
Exporting functions: pdf_fit
, png_fit
.
The function closing the connection and showing the obtained graph in the viewer:
fit.off
.
#
# How to set the page size
#
# All examples below provide the same page size
setFplot_page(page = "us")
setFplot_page(page = "8.5in, 11in")
setFplot_page(page = "8.5/11in")
setFplot_page(page = c(8.5, 11))
# All examples below provide the same margins
setFplot_page(margins = "normal")
setFplot_page(margins = "2cm, 2.5cm, 2cm, 2.5cm")
setFplot_page(margins = "2/2.5/2/2.5cm")
setFplot_page(margins = c(2, 2.5) / 2.54) # cm to in
setFplot_page(margins = c(2, 2.5, 2, 2.5) / 2.54)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.