1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Data Visualization with Plotly in Python

Connected

Exercise

Changing annotations with buttons

A large e-commerce company's sales department has asked you to assist them in understanding and visualizing their data.

They have provided monthly sales data but use different metrics to determine monthly performance: monthly sales value (in dollars) and sales volume (number of items sold).

They would like to view all this information on the same plot but easily be able to toggle annotations on and off to facilitate their discussion around this.

In this exercise, you will help the sales department analyze their sales data with buttons to turn key annotations on or off.

You have been provided a sales DataFrame and a go.Figure() object will be set up for you.

Instructions 1/2

undefined XP
    1
    2
  • Create annotations to identify the best months for sales value (September) and volume (October).
  • Create buttons that will update the annotations part of your graph layout, ensuring the relevant annotation object is given to each button.