PictureBlock | R Documentation |
PictureBlock
Specialized FileBlock
for managing picture content in reports.
It's designed to handle plots from packages such as ggplot2
, grid
, or lattice
.
It can save plots to files, set titles and specify dimensions.
teal.reporter::ContentBlock
-> teal.reporter::FileBlock
-> PictureBlock
new()
Initialize a PictureBlock
object.
PictureBlock$new(plot)
plot
(ggplot
or grid
) a picture in this PictureBlock
Object of class PictureBlock
, invisibly.
set_content()
Sets the content of this PictureBlock
.
PictureBlock$set_content(content)
content
(ggplot
or grob
or trellis
) a picture in this PictureBlock
Raises error if argument is not a ggplot
, grob
or trellis
plot.
self
, invisibly.
set_title()
Sets the title of this PictureBlock
.
PictureBlock$set_title(title)
title
(character(1)
) a string assigned to this PictureBlock
Raises error if argument is not character(1)
.
self
, invisibly.
PictureBlock <- getFromNamespace("PictureBlock", "teal.reporter") block <- PictureBlock$new() block$set_title("Title")
get_title()
Get the title of this PictureBlock
.
PictureBlock$get_title()
The content of this PictureBlock
.
PictureBlock <- getFromNamespace("PictureBlock", "teal.reporter") block <- PictureBlock$new() block$get_title()
set_dim()
Sets the dimensions of this PictureBlock
.
PictureBlock$set_dim(dim)
dim
(numeric(2)
) figure dimensions (width and height) in pixels.
self
, invisibly.
PictureBlock <- getFromNamespace("PictureBlock", "teal.reporter") block <- PictureBlock$new() block$set_dim(c(800, 600))
get_dim()
Get PictureBlock
dimensions as a numeric vector.
PictureBlock$get_dim()
numeric
the array of 2 numeric values representing width and height in pixels.
PictureBlock <- getFromNamespace("PictureBlock", "teal.reporter") block <- PictureBlock$new() block$get_dim()
clone()
The objects of this class are cloneable with this method.
PictureBlock$clone(deep = FALSE)
deep
Whether to make a deep clone.
library(ggplot2)
library(lattice)
PictureBlock <- getFromNamespace("PictureBlock", "teal.reporter")
block <- PictureBlock$new()
block$set_content(ggplot(iris))
PictureBlock <- getFromNamespace("PictureBlock", "teal.reporter")
block <- PictureBlock$new()
block$set_content(bwplot(1))
PictureBlock <- getFromNamespace("PictureBlock", "teal.reporter")
block <- PictureBlock$new()
block$set_content(ggplotGrob(ggplot(iris)))
## ------------------------------------------------
## Method `PictureBlock$set_title`
## ------------------------------------------------
PictureBlock <- getFromNamespace("PictureBlock", "teal.reporter")
block <- PictureBlock$new()
block$set_title("Title")
## ------------------------------------------------
## Method `PictureBlock$get_title`
## ------------------------------------------------
PictureBlock <- getFromNamespace("PictureBlock", "teal.reporter")
block <- PictureBlock$new()
block$get_title()
## ------------------------------------------------
## Method `PictureBlock$set_dim`
## ------------------------------------------------
PictureBlock <- getFromNamespace("PictureBlock", "teal.reporter")
block <- PictureBlock$new()
block$set_dim(c(800, 600))
## ------------------------------------------------
## Method `PictureBlock$get_dim`
## ------------------------------------------------
PictureBlock <- getFromNamespace("PictureBlock", "teal.reporter")
block <- PictureBlock$new()
block$get_dim()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.