Fixing a Plotly figure
Your colleague started a project to create a visualization of sales for the first three months of 2025. However, she then left for some annual leave—but the boss wants the visualization now!
You can see she left behind a dictionary object that has started to define the visualization. It is your task to finish this dictionary with the important key arguments to turn it into a Plotly visualization.
plotly.express as px and monthly_sales DataFrame have already been loaded for you.
This exercise is part of the course
Introduction to Data Visualization with Plotly in Python
Exercise instructions
- Define
x_columnandy_columnusing the"month"and"sales"columns. - Set
chart_titleto"Sales for Jan-Mar 2025". - Create a bar plot using these variables.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Define the x and y axis columns
x_column = "____"
y_column = "____"
# Define the chart title
chart_title = ____
# Create a bar plot
fig = px.____(
data_frame=monthly_sales, x=____, y=____, title=____)
fig.show()