Plotly Express Basics
Create charts quickly.
What Plotly Express Is
Plotly Express (imported as px) is a high-level interface for making interactive charts with very little code. One function call usually produces a complete, polished figure.
Where Matplotlib is static by default, Plotly figures are interactive: you can hover, zoom, and pan in the browser.
The Tidy Data Idea
Plotly Express works best with tidy data: each row is one observation and each column is one variable. You then name columns to map them onto chart features.
We can model a tidy dataset as a list of dictionaries.
rows = [
{'country': 'A', 'year': 2020, 'gdp': 100},
{'country': 'A', 'year': 2021, 'gdp': 110},
{'country': 'B', 'year': 2020, 'gdp': 80},
]
for r in rows:
print(r['country'], r['year'], r['gdp'])All lessons in this course
- Plotly Express Basics
- Interactive Features
- Dashboards Concepts
- Exporting and Embedding