title: How to write text inside a graphic using shiny::HTML() function?
body: <p>I'm trying to write text inside a <code>plot</code> function in <code>R</code> with a <code>shiny::HTML</code> function.</p>
  <p>But I couldn't do that inside the <code>graphics::text</code> function:</p>
  <p>My shinyApp:</p>
  <pre><code>library(shiny)
  library(shinydashboard)
  
  header &lt;- dashboardHeader(title = &quot;Dashboard&quot;, titleWidth = 300)
  
  sidebar &lt;- dashboardSidebar(width = 300, 
                          
                          sidebarMenu(id = &quot;tabs&quot;,
                                      
                                      menuItem(text = &quot;Plot&quot;, tabName = &quot;plot&quot;, icon = icon(&quot;chart-pie&quot;)) 
                                      
                          )
  )
  
  body &lt;- dashboardBody(
  
    tabItem(tabName = &quot;plot&quot;,
        
        fluidPage(
          
          column(width = 12, 
                 
                 box(plotOutput(outputId = &quot;plot1&quot;, click = &quot;plot_click&quot;), width = 6, title = 
                       &quot;Gráfico 1&quot;)
                 
          ) 
        )
    )
  
  )
  
  ui &lt;- dashboardPage(header, sidebar, body, skin = &quot;blue&quot;)
  
  server &lt;- function(input, output) {
  
    output$plot1 &lt;- renderPlot({
  
      plot(x = .5, y = .5)
  
      graphics::text(
        x = .5, y = .5, cex = 1.8,
    
        HTML(&quot;&lt;p&gt; First line;&lt;br&gt;
        Second line;&lt;br&gt;
        Third line.&lt;/p&gt;&quot;)
      
      )
  
    })
  
  }
  
  shinyApp(ui, server)
  </code></pre>
  <p>But:</p>
  <p><a href="https://i.stack.imgur.com/UDvAO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UDvAO.png" alt="enter image description here" /></a></p>
  <p>Function does not work (HTML tags are not recognized).</p>
  <p>How to solve this?</p>