1. Moving Beyond Simple Interactivity
plotly makes it easy to create clean interactive graphics entirely in R, but interactive tool tips are only the beginning of plotly's capabilities. In this course you will explore how to super-charge your interactive graphics using animations and linked brushing.
Over the next two chapters, we will explore two primary datasets.
2. Country-level economic indicators
The first dataset contains six economic indicators on economic conditions in countries across the world from 1960 to 2017. These indicators include: adjusted per capita GDP, a measure carbon dioxide emissions, military spending as a percentage of GDP, and the urban population as a percentage of the whole population.
3. State-level economic data
The second dataset you will explore in the next two chapters contains economic indicators for each state in the United States, along with Washington D.C. These data include the real GDP, employment level, homeownership rate, housing price index, and population of each state.
4. Animating economies
In the next chapter, you will learn how to create animated plots, including the animated bubble chart of carbon dioxide emissions against per capita GDP. Using animation, it's easy not only to see the clear relationship between carbon dioxide emissions and income, but also the clear rise of China and India in both indices.
This rise is so clear because animation draws our attention to changes over time far better than comparing small multiples.
5. Static bubble charts
Before we animate a bubble chart, let's review how one is created by reproducing the 2014 snapshot of carbon dioxide against income.
We begin by filtering the world indicators data set to extract the rows for 2014.
Next, we create the canvas for our plot, mapping income to x, co2 to y, and country names to the hoverinfo text.
Finally, add the markers trace, mapping population to the size of the markers and six_regions to the color. We also pass a list to the markers argument refining the appearance of the points. We allow the size of the points to be governed by the diameter rather than the area by setting sizemode equal to diameter, and shrink the points a touch by setting sizeref to 2.
6. Linked brushing
You'll also learn how to create linked graphics without creating a shiny app via the crosstalk package. In this example, we use a bar chart to select the world region to highlight on the bubble chart, allowing for easy comparison of selected regions to the rest of the world.
7. Linked brushing
Linked brushing can also be persistent, as shown here, allowing us to select multiple regions to call out and compare. This can be quite useful to compare clusters.
8. Highlight on hover
In this course you will also learn how to extend hover tool tips to include dynamic highlighting via the crosstalk package. Here, we use dynamic highlighting to highlight a state's housing price index trajectory to see how it compares to the other states.
9. Let's explore!
Before diving deeper into plotly, let's create the base plots that we'll agument with animation, dyanimic highlighting, and linked brushing in the later chapters.