A copied Figure and the order of the fixes

Predict the output · Medium · §9.3 Figure structure and updates

The code makes a bar chart from votes at festival booths, fixes a copy, and then prints values taken from the two Figures. Predict the three lines of output without running the code.

Code

import pandas as pd
import plotly.express as px
import plotly.graph_objects as go

votes = pd.DataFrame({
    "booth": ["Food", "Game", "Food", "Game", "Food"],
    "votes": [30, 45, 50, 25, 40],
})
fig = px.bar(votes, x="booth", y="votes", color="booth", title="Festival votes")
print(len(fig.data), fig.data[0].name, fig.data[0].y.tolist())

gray = go.Figure(fig)
gray.update_traces(marker_color="#CC79A7", selector={"name": "Game"})
gray.update_traces(marker_color="#BBBBBB")
gray.update_layout(title="Votes by booth")
print(fig.layout.title.text, "|", gray.layout.title.text)
print(gray.data[0].marker.color, gray.data[1].marker.color)

Solve 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.