An annotation pointing to the week with the most plays
Write code · Challenge · §9.4 Exploring and checking
The table podcast holds the weekly plays of a podcast over 8 weeks. Draw a line chart with points, with the week (week) on the x-axis and the plays (plays) on the y-axis. Put the week with the most plays in the title, as in Plays peaked in week 4.
Add the annotation Peak: 2100 plays with an arrow pointing to the point of that week, and put the source line Source: podcast app without an arrow at the lower left in paper coordinates (xref="paper", yref="paper"). Take the numbers in the title and the annotation from the table. Show the figure with fig.show(). Grading changes the play counts and draws the chart again.
Starter code
import pandas as pd
import plotly.express as px
podcast = pd.DataFrame({
"week": [1, 2, 3, 4, 5, 6, 7, 8],
"plays": [1200, 1350, 1500, 2100, 1800, 1600, 1450, 1700],
})
# Write your code hereSolve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.