View source: R/plots-utility-dimensions.R
getPositionAndMargins | R Documentation |
The elements are positioned as following:
on top of the plot
title
subtitle
legend, if positioned on top of the plot
facet title
at the bottom of the plot
label for the x-axis
legend, if positioned on the bottom of the plot
caption
Margins are computed based on the presence
of these elements.
Only one line is counted for the legend,
as plotly will extend the margin
if necessary for the legend (for bottom legend).
getPositionAndMargins(
title = NULL,
subtitle = NULL,
xLab = NULL,
caption = NULL,
facet = FALSE,
includeLegend = TRUE,
legendPosition = "right"
)
title |
String with title for the plot. |
subtitle |
String with subtitle. |
xLab |
String with label for |
caption |
String with caption. |
facet |
Logical, if TRUE the plot contains facets. |
includeLegend |
Logical, if TRUE (by default) a legend is available in the plot. |
legendPosition |
String with position of the legend, among: 'top'/'left'/'bottom'/'right', 'right' by default. |
List with:
'margin': List with bottom ('t') and top ('t') margins in pixels
'position': List with position of the following plot elements:
on top of the plot: subtitle and legend
(if positioned at the top).
The position is defined as the distance in pixels
from the top of the plotting area to the bottom
of the element (yanchor = 'bottom'
)
at the bottom of the plot: caption, xLab
and legend (if positioned at the bottom).
The position is defined as the distance in pixels
from the bottom of the plotting area to the top
of the element (yanchor = 'top'
)
Especially, the legend should be positioned with
anchor 'top' such as the margins are automatically
expanded if the legend contains multiple rows.
Laure Cougnaud
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.