在底部发布的几乎为MWE的代码中,我试图将自定义图像拉入绘图标题.在完整的应用程序中,用户点击图像以触发解释性模式对话.然而,在这种情况下,我无法在绘图头中获得要呈现的图像.在其他适合我的情况下,我使用renderUI()
,但在本例中,我try 在renderPlot()
函数中呈现图像.下面的图片比这些文字更能说明问题.在renderPlot()
号楼里有没有办法做到这一点?
MWe代码:
library(shiny)
library(survival)
### define function ###
weibSurv <- function(t, shape, scale) pweibull(t, shape=shape,scale=scale, lower.tail=F)
ui <- fluidPage(
selectInput("distSelect","Select distribution:",c("Weibull","Gamma")),
sliderInput('shape','Adjust shape:',min=0,max=3,step=0.1,value=1.5),
plotOutput("plot")
)
server <- function(input, output, session) {
output$plot <- renderPlot({
curve(
weibSurv(x, shape=input$shape,scale=1/0.03),
from=0, to=80,
main =
fluidRow(
paste(input$distSelect), # leave paste, actual App has more objects to include here
tags$button(
id = "explainBtn",
class = "btn action-button",
tags$img(src = "https://images.plot.ly/language-icons/api-home/python-logo.png")
)
)
)
})
}
shinyApp(ui, server)