Advanced Plotting Techniques

Two of the most common advanced plotting techniques are scatter plots and bubble charts. Scatter plots show the relationship between two variables. A bubble chart can include a third variable. Each point (with its values (v1, v2, v3) of associated data) is plotted as a disk, where two of the values show the x and y locations, and the third depicts the size. Just like in a scatter plot, a bubble chart uses numerical variables for its x and y axes. You cannot use categorical variables in a bubble chart.

In this plot, we will plot the electricity consumption per capita for different years and different countries. The size of the point will vary, according to the population of the country.

Get Applied Data Visualization with R and ggplot2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.