Assembles a title band and a multi-column body of section cards into a
single gtable::gtable sized for a real paper size (default A1
portrait). The spec can be an R list (built by hand, or by reading YAML
with read_poster_yaml()) or a path to a YAML file, in which case it is
read automatically.
Usage
poster(spec, objects = list(), theme = NULL, base_dir = NULL)Arguments
- spec
An R list following the schema above, or a path to a YAML file.
- objects
Named list of R objects (ggplots, data.frames, grobs) referenced from
sections[[.]]$body$objectin the spec.- theme
A
poster_theme()object. IfNULL(default), it is built fromspec$theme.- base_dir
Directory used to resolve relative image paths in the spec. Defaults to the YAML file's directory, or the working directory for a list spec.
Value
An object of class ggposter, a thin wrapper around a
gtable::gtable. Print it to preview, or pass it to
render_poster() to save a PDF/PNG at true size. To inspect the layout
with each card's content area outlined, pass show_plot_area = TRUE to
render_poster() – it's an output option, so the same poster object
renders both the normal and the outlined version.
Details
See the package vignette for the full spec schema. In short:
postersize(e.g."A1") andorientation.themeArguments passed to
poster_theme().titleArguments passed to
poster_title().layoutcolumns,left,right(or any other column names): which section names go in which column, top to bottom. Setalign_rows: trueto line up each row position across columns to the tallest"auto"-height card at that position, instead of each column stacking at its own height. Every section must appear exactly once across all columns.gridAn alternative to
layoutfor irregular (CSS-Grid-like) arrangements where a card spans multiple columns and/or rows:columns(integer) andboxes(a list oflist(name=, x=, y=, w=, h=),x/y0-based,w/hdefaulting to1). Row heights follow the sameheight/"auto"rule aslayout, but resolved per row from whichever boxes in that row don't span multiple rows; a spanning box never stretches the rows/columns it spans, it is top-left anchored at its own natural size within them. Overlapping or out-of-bounds boxes, and any section not placed in exactly one box, raise an error; content taller than the page raises a warning. If bothlayoutandgridare set,gridwins (with a warning).sectionsNamed list; each has
header, optional relativeheight, and abodyoftype"text","table","figure", or"image"plus that type's arguments.
A spec may also be written the way the sibling tools acposter
(build-poster-pdf) and qtposter write a header – flat, with the
metadata at the top level rather than inside title/poster/theme
– so that one header serves all three unchanged:
title: "A poster"
author: ["A. One", "B. Two"] # authors, poster-authors
institute: "Somewhere Univ." # institutes, affiliation(s)
note: "Funded by X" # funding, footer
paper: A1 # -> poster$size
orientation: portrait
columns: 2 # -> an equal-share layout
font-size: 20 # -> theme$base_size
font: "Noto Sans" # -> theme$base_familyEach key is folded into the block it belongs to and renamed to
ggposter's own: author/authors/poster-authors -> title$authors,
institute/institutes/affiliation(s) -> title$affiliations,
note/funding/footer -> title$funding, paper -> poster$size,
font-size/font/cjk-family ->
theme$base_size/base_family/cjk_family. A list of authors or
affiliations (as the other two tools write them) is joined into the one
line poster_title() draws. Setting the same thing twice – a key and
its alias, or the flat and the nested form – keeps ggposter's own and
warns. Nested specs are untouched, and the two forms can be mixed.
A bare size is not accepted: qtposter means type size by it and a
spec here means paper, so write font-size or paper.
A top-level columns count (as cols too) stands in for layout when
neither layout nor grid is given: the sections flow down the
leftmost column and on into the next, in spec order, split as evenly as
they divide. Given alongside layout/grid it is ignored, with a
warning.