| 1 |
library(shiny) |
| 2 |
library(ggplot2) |
| 3 |
library(thematic) |
| 4 |
|
| 5 |
thematic_shiny("black", "white", font = font_spec("Pacifico", 1.25, update = TRUE)) |
| 6 |
|
| 7 |
ui <- fluidPage( |
| 8 |
imageOutput("CairoPNG") |
| 9 |
) |
| 10 |
|
| 11 |
render_image <- function(expr) { |
| 12 |
snapshotPreprocessOutput(renderImage(expr), function(value) {}) |
| 13 |
} |
| 14 |
|
| 15 |
server <- function(input, output, session) { |
| 16 |
output$CairoPNG <- render_image({ |
| 17 |
file <- thematic_save_plot( |
| 18 |
qplot(1:10) + ggtitle("Cairo::CairoPNG"), |
| 19 |
device = Cairo::CairoPNG, |
| 20 |
width = 800, height = 400 |
| 21 |
) |
| 22 |
list(src = file, width = 800, height = 400) |
| 23 |
}) |
| 24 |
} |
| 25 |
|
| 26 |
shinyApp(ui, server) |