Plot slide layout properties into corresponding placeholders.
This can be useful to help visualize placeholders locations and identifiers.
All information in the plot stems from the layout_properties()
output.
See Details section for more info.
plot_layout_properties(
x,
layout = NULL,
master = NULL,
labels = TRUE,
title = TRUE,
type = TRUE,
id = TRUE,
cex = c(labels = 0.5, type = 0.5, id = 0.5),
legend = FALSE
)
an rpptx
object
slide layout name or numeric index (row index from layout_summary()
. If NULL
(default), it plots
the current slide's layout or the default layout (if set and there are not slides yet).
master layout name where layout
is located. Can be omitted if layout is unambiguous.
if TRUE
(default), adds placeholder labels (centered in red).
if TRUE
(default), adds a title with the layout name at the top.
if TRUE
(default), adds the placeholder type and its index (in square brackets)
in the upper left corner (in blue).
if TRUE
(default), adds the placeholder's unique id
(see column id
from
layout_properties()
) in the upper right corner (in green).
List or vector to specify font size for labels
, type
, and id
. Default is
c(labels = .5, type = .5, id = .5)
. See graphics::text()
for details on how cex
works.
Matching by position and partial name matching is supported. A single numeric value will apply to all
three parameters.
Add a legend to the plot (default FALSE
).
The plot contains all relevant information to reference a placeholder via the ph_location_*
function family:
label
: ph label (red, center) to be used in ph_location_label()
.
NB: The label can be assigned by the user in PowerPoint.
type[idx]
: ph type + type index in brackets (blue, upper left) to be used in ph_location_type()
.
NB: The index is consecutive and is sorted by ph position (top -> bottom, left -> right).
id
: ph id (green, upper right) to be used in ph_location_id()
(forthcoming).
NB: The id is set by PowerPoint automatically and lack a meaningful order.
Other functions for reading presentation information:
annotate_base()
,
color_scheme()
,
doc_properties()
,
layout_properties()
,
layout_summary()
,
length.rpptx()
,
slide_size()
,
slide_summary()
x <- read_pptx()
# select layout explicitly
plot_layout_properties(x = x, layout = "Title Slide", master = "Office Theme")
plot_layout_properties(x = x, layout = "Title Slide") # no master needed if layout name unique
plot_layout_properties(x = x, layout = 1) # use layout index instead of name
# plot current slide's layout (default if no layout is passed)
x <- read_pptx()
x <- add_slide(x, "Title Slide")
plot_layout_properties(x)
#> ℹ Showing current slide's layout: "Title Slide"
# change appearance: what to show, font size, legend etc.
plot_layout_properties(x, layout = "Two Content", title = FALSE, type = FALSE, id = FALSE)
plot_layout_properties(x, layout = 4, cex = c(labels = .8, id = .7, type = .7))
plot_layout_properties(x, 1, legend = TRUE)