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

Exercise

Changing annotations with buttons

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

They have provided monthly sales data but have different metrics to determine monthly performance; the monthly sales value (in dollars) as well as 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 by creating a bar chart of their sales data with buttons to turn key annotations on or off.

You have been provided a sales DataFrame.

Instructions 1/3

undefined XP
    1
    2
    3
  • Create the basic figure object using plotly.graph_objects (imported as go).
  • Add two bar chart type traces, one for the Sales Volume and one for Sales Value (both with Month on the x-axis).