Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Midoux Cedric
easy16S
Commits
072f854c
Commit
072f854c
authored
Nov 15, 2019
by
Midoux Cedric
Browse files
https://cran.r-project.org/web/packages/periscope/vignettes/downloadablePlot-module.html
parent
f41208ce
Changes
4
Hide whitespace changes
Inline
Side-by-side
global.R
0 → 100644
View file @
072f854c
invisible
(
sapply
(
list.files
(
'src'
,
full.names
=
TRUE
),
source
))
panels/barplot-server.R
View file @
072f854c
...
...
@@ -69,6 +69,7 @@ output$barplotUI <- renderUI({
uiOutput
(
"barplotNbTaxaUI"
),
uiOutput
(
"barplotGridUI"
),
uiOutput
(
"barplotXUI"
),
#downloadButton('downloadPlot', 'Download Plot'),
collapsedBox
(
verbatimTextOutput
(
"barplotScript"
),
title
=
"RCode"
)
)
})
...
...
@@ -104,7 +105,7 @@ output$barplotScript <- renderText({
return
(
glue_collapse
(
script
,
sep
=
"\n"
))
})
output
$
b
arplot
<-
re
nderPlot
({
plotB
arplot
<-
re
active
({
validate
(
need
(
data16S
(),
"Requires an abundance dataset"
),
need
(
input
$
barplotShowRank
,
""
)
...
...
@@ -122,3 +123,16 @@ output$barplot <- renderPlot({
}
return
(
p
)
})
callModule
(
plotDownload
,
"barplot"
,
plotBarplot
)
# output$barplot <- renderPlot({plot()})
# output$downloadPlot <- downloadHandler(
# filename = "barplot.png",
# content = function(file) {
# png(file)
# print(plot())
# dev.off()
# }
# )
panels/barplot-ui.R
View file @
072f854c
barplot
<-
fluidPage
(
withLoader
(
plotOutput
(
"barplot"
,
height
=
700
)),
uiOutput
(
"barplotUI"
))
barplot
<-
fluidPage
(
plotDownloadUI
(
"barplot"
),
#withLoader(plotOutput("barplot", height = 700)),
uiOutput
(
"barplotUI"
)
)
src/download_module.R
0 → 100644
View file @
072f854c
plotDownloadUI
<-
function
(
id
,
height
=
400
)
{
ns
<-
NS
(
id
)
tagList
(
fluidRow
(
plotOutput
(
ns
(
'plot'
),
height
=
height
)
),
fluidRow
(
column
(
2
,
offset
=
10
,
downloadButton
(
ns
(
"download_plot"
),
"Download figure"
)
)
)
)
}
plotDownload
<-
function
(
input
,
output
,
session
,
plotFun
)
{
output
$
plot
<-
renderPlot
({
plotFun
()
})
output
$
download_plot
<-
downloadHandler
(
filename
=
function
()
{
"plot.png"
},
content
=
function
(
file
)
{
ggsave
(
file
,
plotFun
(),
width
=
16
,
height
=
10.4
)
}
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment