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

Customize tooltips - R Tutorial

From the course: R: Interactive Visualizations with htmlwidgets

Start my 1-month free trial

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…

Contents