Eu estou tentando usar a função shiny::HTML
dentro de graphics::text()
mas as tags HTML
não são reconhecidas. Eu tentei usar as funções tags$...
mas também não dá certo. Como posso fazer isso? Segue meu código para auxílio na resposta:
library(shiny)
library(shinydashboard)
header <- dashboardHeader(title = "Dashboard", titleWidth = 300)
sidebar <- dashboardSidebar(width = 300,
sidebarMenu(id = "tabs",
menuItem(text = "Plot", tabName = "plot", icon = icon("chart-pie"))
)
)
body <- dashboardBody(
tabItem(tabName = "plot",
fluidPage(
column(width = 12,
box(plotOutput(outputId = "plot1", click = "plot_click"), width = 6, title =
"Gráfico 1")
)
)
)
)
ui <- dashboardPage(header, sidebar, body, skin = "blue")
server <- function(input, output) {
output$plot1 <- renderPlot({
plot(x = .5, y = .5)
graphics::text(
x = .5, y = .5, cex = 1.8,
HTML("<p> First line;<br>
Second line;<br>
Third line.</p>")
)
})
}
shinyApp(ui, server)
Preciso usar isso dentro dessa função mesmo, pois o gráfico original que tenho é reativo, portanto outra alternativa pode não funcionar pra mim.
- Usei
graphics::text
pois uso o ambientegolem
. - Preciso usar
shiny::HTML
para editar melhor o texto dentro do gráfico original (que é reativo). Pra mim, usar\n
e escrever normalmente emtext
não é interessante.