Matplotlib is a Python library for creating static, animated, and interactive visualizations. It provides powerful plotting capabilities, while pandas offers a simpler plotting API that uses Matplotlib underneath. section 11.0
A practical Matplotlib-based workflow typically involves:
- Preparing the data by filtering rows, selecting columns, changing indexes, cleaning strings, and converting values to numeric types. section 11.2
- Choosing a plot that matches the question, such as bar, pie, scatter, or line plots. section 11.2
- Sorting values before plotting when the visual comparison depends on order. section 11.2
- Adjusting presentation with options such as figsize when many categories make the default chart difficult to read. section 11.2
Counting cities by state
Group the city data by state, count the city values, sort the resulting Series, and plot it as a bar chart: df.groupby('state')['city'].count().sort_values().plot.bar(figsize=(10,10)). section 11.2
A Jupyter notebook can keep code, data, and Matplotlib-generated plots together inline, supporting experimentation and sharing. section 11.0



