Chapter 3 Plotly
(Computer Labs 1B+)
A key component of data science is the effective and informative visualisation of data.
Throughout Computer Labs 1B to 4B, we will be using the
plotly R package (Sievert 2020) to create data visualisations that are dynamic and interactive.
You will learn how to create various interactive graphs with
plotly, such as the one shown below (which uses data from the
palmerpenguins (Horst, Hill, and Gorman 2020) R package).
A few key aspects of this
plotly graph which separate it from the static graphs which can be produced in base R are:
- If you hover over the data points in the graph, you can see information about the data.
- If you click on the legend items, you can dynamically filter out categories - just reclick the item to bring the corresponding data back.
- You can left-click and drag a box within the graph, to zoom in on a specific portion of the graph
- As you interact with the graph, the axes will dynamically adjust.
Take a look at this video featuring the late Hans Rosling (a world-renowned physician and an engaging public speaker) - by the end of these computer labs you will have the skills to create a similar interactive and animated plot!
BBC. (2010, Nov. 26). Hans Rosling’s 200 Countries, 200 Years, 4 Minutes - The Joy of Stats - BBC 4 [Video]. YouTube. https://www.youtube.com/watch?v=jbkSRLYSojo↩︎