I would like you to resdesign this: I would to have a card with the title "Volcano plot" that contains a plot. I want the card to have a footer with a button that says "Plot description" and another that says "Download plot". I want them to be as a footer of the card and the card no to have a sidebar.
Drop files here
or click to upload
library(shiny)
library(bslib)
ui <- page_fillable(
card(
full_screen = TRUE,
card_header("Volcano plot"),
plotOutput("plot"),
card_footer(
actionButton("description", "Plot description"),
downloadButton("download", "Download plot")
)
)
)
server <- function(input, output, session) {
# Render the volcano plot
output$plot <- renderPlot({
plot(volcano)
})
# Handle the description button click
observeEvent(input$description, {
showModal(modalDialog(
title = "Volcano Plot Description",
"This is a plot of the Maunga Whau (Mount Eden) volcano in Auckland, New Zealand.
The dataset gives the topographic information on a 10m by 10m grid.",
easyClose = TRUE,
footer = NULL
))
})
# Handle plot download
output$download <- downloadHandler(
filename = function() {
"volcano_plot.png"
},
content = function(file) {
png(file)
plot(volcano)
dev.off()
}
)
}
shinyApp(ui, server)
Hi! I can help you with any questions about Shiny and R. What would you like to know?