From the course: R: Interactive Visualizations with htmlwidgets
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Extract click information from Plotly - R Tutorial
From the course: R: Interactive Visualizations with htmlwidgets
Extract click information from Plotly
- [Instructor] Shiny allows interactive web applications to be built using the R language. Let's see how we can embed a plotly htmlwidget inside of a Shiny app and extract the click information from it. To start, let's see the skeleton of my Shiny app. In our exercise files, let's open server.R. I'll minimize the environment because I don't need to see it for now. We can see inside of the renderPlotly function, lines 12 through 27 generate me a ggplot object which I store against gg_facet_weather, and then we can see we used a function ggplotly to convert the static ggplot2 visualization into an interactive plotly chart. Let's view this Shiny app by clicking Run App, and we can see I have my facet wrapped ggplot2 visualation converted into an interactive plotly chart. I have a tooltip and I'm also able to zoom in on my charts as well. The interactivity I'd like is that when I click on one of these markers, it updates the text here to read, clicked marker coordinates are, so on and so…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
What is the Plotly library?9m 50s
-
Make ggplot2 interactive using Plotly7m 27s
-
Create interactive stacked bar charts9m 3s
-
Interactive scatter, line, and bubble charts with Leaflet8m 15s
-
Create interactive maps8m 47s
-
Specify custom colors7m 11s
-
Customize tooltips4m 33s
-
Combine multiple charts7m 18s
-
Extract click information from Plotly6m 22s
-
-
-
-
-