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

Connected

Exercise

Revenue histogram subplots

The revenue histogram with colors by industry (with stacked bars) you created for the New York Stock Exchange firm was enlightening, as it showed which industries tended to be in which area of the histogram.

However, the firm wishes to understand the distribution of each industry without having to hover to see. The previous histogram has too much in a single plot for this analysis, but they don't want multiple plots. How can you help solve this conundrum?

Your task is to create a histogram of company revenues by industry as a stacked subplot and a shared x-axis to allow meaningful comparison of industries.

You have a revenues DataFrame loaded for you.

Instructions

100 XP
  • Create a subplot grid with 3 rows and 1 column, and share the x-axis.
  • Loop through the selected industries and add a histogram trace for each.
  • Place each trace in the correct row of the subplot grid.