From the course: R: Interactive Visualizations with htmlwidgets
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Customize tooltips - R Tutorial
From the course: R: Interactive Visualizations with htmlwidgets
Customize tooltips
- [Instructor] Let's have a look at how to customize tool tips in Plotly. The example I'm going to use is a scatter geo plot but the same rules apply everywhere inside of Plotly library so let's open up scatter-geo.R in our exercise files and I'll decrease the size of the environment because I don't need it for now. In the top of the script file, I load three libraries I need: the first is the tidyverse library. Let's run this with Command + Enter. Let's load the oidnChaRts library, again with Command + Enter and finally the Plotly library. Okay. So, on Line 5 I manipulate the object data underscore scatter underscore geo and what I do with it is I separate the location column into two new columns called country and city, separating them via the comma inside of our argument. Let's run that code with Command + Enter and in our console, let's type data underscore scatter geo and pipe this into view. So, our data has a country column, a city column, a latitude, a longitude and a count of…
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
-
(Locked)
Make ggplot2 interactive using Plotly7m 27s
-
(Locked)
Create interactive stacked bar charts9m 3s
-
(Locked)
Interactive scatter, line, and bubble charts with Leaflet8m 15s
-
(Locked)
Create interactive maps8m 47s
-
(Locked)
Specify custom colors7m 11s
-
(Locked)
Customize tooltips4m 33s
-
(Locked)
Combine multiple charts7m 18s
-
(Locked)
Extract click information from Plotly6m 22s
-
-
-
-
-