AI ERA SERIES 02
Python Data Visualization
From one chart to a dashboard
Graph problems follow the contents chapter by chapter and section by section. Draw a chart with code, and Python in your browser reads the values and labels from your figure and compares them with the target figure.
135 problems (18 predict the output, 19 fill in the blanks, 70 write code, 28 code review)
Start practicing in your browser
Chapter 1: Why we visualize, and getting set up
1.1 Visualization answers questions
- Charts for comparison and trend questions Fill in the blanks · Basic
- Charts for distribution and relationship questions Fill in the blanks · Basic
1.2 Setting up your environment No problems
1.3 Setting up fonts No problems
1.4 Drawing your first chart
- Reading a first line chart in five steps Fill in the blanks · Basic
- A line chart of steps in a week Write code · Basic
- A chart of bus riders by hour with a custom size Write code · Medium
1.5 Checking an AI draft
- An AI draft that cuts the y-axis at 40 Code review · Basic
- An AI draft that needs one color and a unit Code review · Basic
Chapter 2: Matplotlib basics Making a single chart
2.1 Matplotlib and setup
- Days and sales at the same position Predict the output · Basic
- Code that imports pyplot the wrong way Code review · Basic
2.2 How Figure, Axes, and Axis fit together
- Figure and Axes under swapped names Predict the output · Medium
- Splitting the work between the Figure and the Axes Fill in the blanks · Basic
2.3 Two ways to make a chart
- The current Axes that plt commands act on Predict the output · Medium
- Axes methods that match plt commands Fill in the blanks · Basic
2.4 Finishing and saving a single chart
- A bar chart of rentals by day Write code · Basic
- A washer chart with a line style and gridlines Write code · Medium
- A bar chart saved as a PNG in a folder Write code · Medium
2.5 Converting code and checking for errors
- Rewriting a seedling chart in the fig, ax style Write code · Medium
- Errors made while converting from the plt style Code review · Basic
- Argument order hidden behind an error Code review · Medium
Chapter 3: Matplotlib in practice Comparing with several charts
3.1 From one chart to many
- Counting Axes and lines Predict the output · Basic
- A legend that tells two lines apart Write code · Medium
3.2 Arranging and reaching Axes
- The Axes array from subplots Predict the output · Medium
- A day's records on 2×2 Axes Fill in the blanks · Basic
- Four charts for four questions Write code · Medium
3.3 Shared axes and fair comparisons
- Ranges of shared and unshared axes Predict the output · Medium
- Two bar charts that share the y-axis Write code · Medium
- Two stacked charts that share only the x-axis Write code · Medium
3.4 Titles, legends, and layout
- Saving a figure with a figure title and Axes titles Write code · Medium
- A legend only on the Axes with two lines Write code · Medium
- Checking an AI draft against the request Code review · Challenge
3.5 Putting it together and checking for errors
- A 2×2 report of a plant's weekly metrics Write code · Challenge
- A 2×2 club membership figure that stops with an error Code review · Medium
- A power figure with a missing left line Code review · Medium
Chapter 4: Seaborn basics Connecting data to charts
4.1 Mapping table columns to a chart
- The shape of cafeteria sales in long format Predict the output · Medium
- An exercise line chart with ticks only at week numbers Fill in the blanks · Basic
- A classroom temperature line chart from DataFrame columns Write code · Basic
4.2 Color groups and summary values
- Grouped bars for a sunny week and a rainy week Write code · Basic
- Monthly exercise with one line per person Write code · Medium
- Average rating by genre with error bars turned off Write code · Medium
4.3 Arranging charts and saving results
- Sharing an axis between visitor lines and stay bars Fill in the blanks · Medium
- Saving a bar chart of movies by genre at a set pixel size Write code · Medium
- An AI draft with mean bars under a title about totals Code review · Medium
Chapter 5: Seaborn in practice Choosing the chart that fits the question
5.1 Checking the question and the data
- A DataFrame built from a list repeated twice Predict the output · Basic
- Finding the genre with the largest total Write code · Medium
- A bar chart of total study hours by subject Write code · Medium
5.2 Scatter plots and groups
- A scatter plot colored by study method Write code · Basic
- A trend line for the mileage and price of used cars Write code · Medium
- Counting overlapping points in a scatter plot Write code · Medium
5.3 Facets and returned objects
- Fixing the panel titles and the left panel of a FacetGrid Fill in the blanks · Medium
- A scatter plot split into panels by OS Write code · Medium
- A figure title stuck on the last panel Code review · Medium
5.4 Comparing shares and sizes
- A 100% stacked bar chart with a different total each term Fill in the blanks · Medium
- A pie chart of smartphone OS shares Write code · Basic
- A sorted horizontal bar chart that shows the sales ranking Write code · Medium
5.5 Reviewing and reading your chart choice
- A heatmap of averages by OS and age group Write code · Challenge
- A draft that chose bars for a relationship question Code review · Basic
- A draft that drew multiple-response answers as a pie chart Code review · Medium
Chapter 6: Polishing charts I Color, axes, ticks, and annotations
6.1 Diagnosing before polishing
- The order of lines in ax.lines Predict the output · Medium
- A highlighted line covered in gray Code review · Medium
6.2 Colors, lines, and markers
- A color dictionary that fixes each city's color Write code · Medium
- Highlighting only the busiest building Write code · Medium
6.3 Axes, ticks, and units
- Tick labels in milliseconds Write code · Medium
- Readable tick labels on a log axis Write code · Challenge
6.4 Annotations and reference lines
- What idxmax returns on a filtered DataFrame Predict the output · Medium
- An annotation on the peak found in the DataFrame Write code · Medium
- A capacity reference line and sections over capacity Write code · Medium
6.5 The final chart and peer review
- A final chart titled with an observation Write code · Challenge
- A bar range and a hard-coded annotation flagged in peer review Code review · Medium
Chapter 7: Polishing charts II Legends, layout, style, and AI review
7.1 The question and the review order
- Two bar charts with a different summary for each question Write code · Medium
- A title that says total and bars drawn on top of each other Code review · Basic
7.2 Legends, direct labels, and grids
- A light horizontal grid behind the bars and tidy spines Write code · Basic
- A legend outside the Axes so it does not hide the lines Write code · Medium
- Direct labels at the ends of lines instead of a legend Write code · Medium
7.3 Layout and returned objects
- The objects that seaborn functions return Predict the output · Medium
- Adjusting facets the FacetGrid way Fill in the blanks · Medium
- Two seaborn panels adjusted through the returned Axes Write code · Medium
7.4 Reusing styles and reviewing AI drafts
- A style function that gives three panels the same look Write code · Medium
- An old style name, a cut-off axis, and a missing unit in an AI draft Code review · Medium
- Splitting a dual y-axis draft into two panels Code review · Medium
7.5 A one-page report and peer review
- A one-page report that answers two questions Write code · Challenge
- Reviewing the ranges, colors, and figure title of a colleague's report Code review · Challenge
Chapter 8: Reading distributions Data beyond the average
8.1 Differences the average hides
- Commute times with the same mean but different medians Predict the output · Medium
- Cafe wait times compared by mean and median Write code · Medium
8.2 Histogram bins
- The bin for a score on an edge Predict the output · Medium
- Two convenience store histograms lined up one above the other Fill in the blanks · Basic
- Bin edges for a battery life histogram Write code · Basic
8.3 Comparing groups by density
- Density heights and bin areas Predict the output · Medium
- Wait time densities for two rides with different numbers of records Write code · Medium
- Density step lines with the area scaled for each section Write code · Medium
8.4 Box plots and possible outliers
- A box plot of apple weights by variety Write code · Basic
- Vending machine sales outside the 1.5×IQR bounds Write code · Medium
- A box plot draft that deleted possible outliers Code review · Basic
8.5 Choosing a chart and reporting a distribution
- A parking time histogram that leaves out records to check Write code · Medium
- A distribution report with density curves and raw data points Write code · Challenge
- Mean bars that do not fit the question Code review · Basic
Chapter 9: Plotly basics Charts you can explore
9.1 From static figures to exploration
- Moving a Seaborn scatter plot to Plotly Express Fill in the blanks · Basic
- Monthly members of two clubs Write code · Basic
- Monthly mean temperatures in two cities Write code · Medium
9.2 Scatter plots, tooltips, and averages
- A scatter plot with the trail name at the top of the tooltip Write code · Medium
- Average daily riders per route, drawn from a table of means Write code · Medium
- An hourly wait-time line that joins two days of rows as they are Code review · Medium
9.3 Figure structure and updates
- A copied Figure and the order of the fixes Predict the output · Medium
- A strawberry harvest bar chart fixed through its traces, layout, and axes Fill in the blanks · Basic
- A PM2.5 chart with only the Suwon line made thicker Write code · Medium
9.4 Exploring and checking
- A line drawn from a table sorted by distance, and zooming in Predict the output · Medium
- An annotation pointing to the week with the most plays Write code · Challenge
- A line that jumps back after joining two quarterly tables Code review · Basic
9.5 Saving and sharing as HTML
- A visitors-by-time-slot chart that opens without the internet Write code · Medium
- A ferry display-screen HTML that needs the internet to draw Code review · Basic
Chapter 10: Plotly in practice Building an interactive report
10.1 Twelve months of data and graph_objects
- A rainfall tooltip text and month-name ticks Fill in the blanks · Medium
- Monthly meals at two cafeterias, added in a loop Write code · Medium
- A blood-donor chart that makes a new Figure inside the loop Code review · Medium
10.2 Subplots, axes, and legends
- Separate axis titles and ranges for the two panels of a water-use chart Fill in the blanks · Medium
- A pool subplot that ties each month line and total bar to one legend item Write code · Challenge
- A ski-pass y-axis setting that lands on both panels Code review · Medium
10.3 Date axes and range exploration
- Rows picked by a date condition and the points on a zoomed chart Predict the output · Medium
- A campsite bookings line with a range slider and period buttons Write code · Medium
- Shelter adoption bars added up again from September to the end of the year Write code · Medium
10.4 Assembling an HTML report
- Annual ticket bars for three venues, with comma values and hatching Write code · Medium
- A farm market HTML report with two charts and a sentence Write code · Challenge
- An ice rink report with blank charts and numbers that do not follow the data Code review · Medium
10.5 Reviewing the report
- The check output of a flower shop report with a cdn piece put in twice Predict the output · Challenge
- Counting charts, Plotly.js, external addresses, and points in a saved bakery report Write code · Medium
Chapter 11: Streamlit Turning charts into a dashboard
11.1 Running an app and the rerun model
- Reading the visitors CSV next to the app file Fill in the blanks · Basic
- A reading room app that stops when the file is missing or empty Write code · Medium
11.2 Data, widgets, and filters
- A food truck app that keeps the chosen menus and days Fill in the blanks · Basic
- Total members of the chosen clubs Write code · Basic
- A bike station app that picks hours and a count Write code · Medium
11.3 Connecting charts and tables
- A table and CSV download with only the chosen levels Fill in the blanks · Basic
- A subheader and three metrics that state the chosen range Write code · Medium
- A trend line and a total bar chart from the same table Write code · Challenge
11.4 Checking numbers and diagnosing errors
- A draft that draws the metrics before checking for an empty choice Code review · Medium
- A draft whose bar chart adds up every week Code review · Medium
11.5 Editing and optional extensions
- A download file named after the chosen buildings and months Write code · Medium
- A period conversion rate from summed counts Write code · Medium