Creating a Plotly Express Chart Using the Dataset
Explore how to create insightful scatterplots using Plotly Express by manipulating dataset variables like year, indicator, and grouping categories. Learn to enrich visualizations by adding new columns or merging external data for deeper analysis and context.
We'll cover the following...
Summarizing a dataset using scatterplots
Let’s see how we might summarize the poverty data_frame with a scatterplot.
-
Lines 2–4: We create variables for
year,indicator, and a grouping (grouper) metric to use in the visualization. The grouping metric will be used to distinguish between the markers (usingcolorandsymbol) and could take any categorical value from the dataset, such as region, income group, and so on. -
Lines 7–9: Based on these variables, we created a DataFrame in which the
yearcolumn is equal toyear, sorted the values byindicator, and removed any missing values from the columns ofindicatorandgrouper. -
Lines 12–21: We set the ...