Calculate coordinates and h|vjust values for entry text strings, to achieve the desired justification and alignment with respect to cell boundaries. This is an internal utility function, not intended to be called by package users.
Data frame with one row per entry. Required columns are
Numeric vectors with one element per entry, giving the coordinates (in mm) of the boundaries of the cell(s) containing each entry. Note that the origin is at the top left of the table.
Data frame with one row per entry, and columns
Optional numeric vector with one element per entry. It specifies
horizontal alignment of multiple lines within an entry *with respect to
each other*. 0 means all lines in the entry are aligned at their left
edge ("left justified"), 1 means they are all aligned at their right edge
("right justified"), 0.5 means they are aligned at their centers. The
default is to use column
The need to jointly calculate
gg_vjust is due to a difference between
ggplot2 in their interpretations of text justification.
ggplot2 interprets justification parameters as indicating position
of text relative to the (x,y) coordinates used to draw the text: 0 means
to the right/above (x,y), 1 means to the left/below (x,y).
tablesgg interprets justification parameters as position relative
to the boundaries of the table cell(s) containing the entry text: 0 means
at the left/top boundary, 1 means at the right/bottom boundary.
This function takes cell boundary coordinates
tablesgg-type justification parameters and
converts them to the
ggplot2-type (x,y) coordinates and
justification parameters. In doing so it is also necessary to take any
text rotation (specified by graphical property
angle) into account.
Values provided to
geom_* functions should be
vjust=gg_vjust. If the
function has an
halign argument (e.g., for
set it to
Justification values in [0, 1] will never position text closer to cell
boundaries than the padding specified by
Data frame with one row per row of
df. Columns are:
Coordinates to give to a
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.