8 Practical 1

8.1 Setup

To begin with, load the plotly.express module and course package

import plotly.express as px
import jrpyvisualisation

Then we will load the gapminder data set

gapminder = jrpyvisualisation.datasets.load_gapminder()

When loading in data, it’s always a good idea to carry out a sanity check. I tend to use commands like


8.2 Scatter plots

Scatter plots can be created using the plotly.express.scatter function. Let’s start with a basic scatter plot

fig = px.scatter(gapminder, x='gdpPercap', y='lifeExp')

To view this plot, we can call the .show() method on the Figure object