How to use plotly for graphical representation


You'll find some interesting resources and examples in the plotly book

For shiny, I would advice to work on the plot with example data outside of shiny, then include in shiny app and use the correct reactive value.

For now, we don't have enough information to know what is going wrong in your case. Please follow the guide to create a reprex: Shiny debugging and reprex guide
so that you help us help you.

One thing is that the function to create graph in plotly :package: is plot_ly as in the doc 2 Overview | Interactive web-based data visualization with R, plotly, and shiny
Here you are using plotly which I don't think is used how you think. Check ?plotly::plotly
It says

This function is now deprecated. It used to provide a way to store plotly account credentials, but that can now be done with environment variables. For more details and examples, see Getting started with plotly in R.

If you're here looking for an intro/overview of the package, see the readme

Hope it helps