context("get_titles")
test_that("get titles", {
df <- data.frame(x = 1:3, y = 1:3)
p <- ggplot(df, aes(x, y)) + geom_point()
expect_s3_class(get_title(p), "zeroGrob")
expect_s3_class(get_subtitle(p), "zeroGrob")
p <- p + labs(title = "Title", subtitle = "Subtitle")
expect_s3_class(get_title(p), "titleGrob")
expect_s3_class(get_subtitle(p), "titleGrob")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.