-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
124 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
library(shiny) | ||
library(ggplot2) | ||
library(esquisse) | ||
|
||
|
||
ui <- fluidPage( | ||
tags$h2("ggplot output"), | ||
fluidRow( | ||
column( | ||
width = 3, | ||
selectInput("var", "Variable:", names(economics)[-1]), | ||
sliderInput("width", "Width:", 0, 1600, 800), | ||
sliderInput("height", "Height:", 0, 1600, 400), | ||
tags$p( | ||
"Width: ", textOutput("plot_width"), | ||
tags$br(), | ||
"Height: ", textOutput("plot_height") | ||
) | ||
), | ||
column( | ||
width = 9, | ||
ggplot_output("MYID", width = "600px", height = "400px") | ||
) | ||
) | ||
) | ||
|
||
server <- function(input, output, session) { | ||
|
||
rv <- render_ggplot( | ||
id = "MYID", | ||
{ | ||
ggplot(economics) + | ||
geom_line(aes(date, !!sym(input$var))) + | ||
theme_minimal() + | ||
labs( | ||
title = "A cool chart made with ggplot2", | ||
subtitle = "that you can export in various format" | ||
) | ||
}, | ||
resizable = TRUE, | ||
width = reactive(input$width), | ||
height = reactive(input$height) | ||
) | ||
|
||
output$plot_width <- renderText(rv$plot_width) | ||
output$plot_height <- renderText(rv$plot_height) | ||
|
||
} | ||
|
||
if (interactive()) | ||
shinyApp(ui, server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.