title: Shiny R - ggplotly - Show custom message instead of empty plot when the dataset does not return any information
body: <p>The shiny application I'm working on is displaying graphs using ggplotly. In an instance when the resulting dataset is empty, a blank plot is being displayed, as below. 
  <a href="https://i.stack.imgur.com/3iwI4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3iwI4.png" alt="enter image description here"></a></p>
  
  <p>Is it possible to show a custom message such as "No data exists with the selected inputs" instead of an empty plot</p>
  
  <p>With the help of validate, need I am able to display the error message when the user does not select input in the front-end -</p>
  
  <pre><code>validate(
        need(input$category, 'No data exists, please select a Category')
        )
  </code></pre>
  
  <p><br><br>
  I would like to display a custom message similarly in the server side when the final dataset is empty, I've tried below codes so far as per the help from google. These codes aren't giving any errors, but the error message is being print by default.</p>
  
  <pre><code>validate(
      need(nrow(dataset() &gt; 0), 'Message here')
      )
  </code></pre>
  
  <p>or</p>
  
  <pre><code>validate(
      need(is.null(dataset), 'Message here')
      )
  </code></pre>
  
  <p><br><br>
  I am plotting with the help of below code, where g() is my final dataset after filter applied basis user input -</p>
  
  <pre><code>output$plot1 &lt;- renderPlotly({
      p &lt;- ggplot(g(), aes_string(x=input$x, y=input$y)) + geom_point(alpha=0.4)
      ggplotly(p)
  
    })
  </code></pre>
  
  <p>I am new to Shiny and R, any help is appreciated.</p>
  
  <p>Thanks.</p>