0
0
Matplotlibdata~10 mins

Spine charts concept in Matplotlib - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the matplotlib library for plotting spine charts.

Matplotlib
import [1] as plt
Drag options to blanks, or click blank then click option'
Aseaborn
Bpandas
Cmatplotlib.pyplot
Dnumpy
Attempts:
3 left
💡 Hint
Common Mistakes
Importing the whole matplotlib instead of pyplot.
Using unrelated libraries like pandas or numpy.
2fill in blank
medium

Complete the code to create a figure and axis for plotting a spine chart.

Matplotlib
fig, ax = plt.[1]()
Drag options to blanks, or click blank then click option'
Asubplots
Bshow
Cplot
Dfigure
Attempts:
3 left
💡 Hint
Common Mistakes
Using plot() which draws lines but does not create figure and axis.
Using figure() alone which returns only the figure.
3fill in blank
hard

Fix the error in the code to set the spine color to red.

Matplotlib
ax.spines['bottom'].set_[1]('red')
Drag options to blanks, or click blank then click option'
Aposition
Bwidth
Cvisible
Dcolor
Attempts:
3 left
💡 Hint
Common Mistakes
Using set_width which changes thickness, not color.
Using set_visible which hides or shows the spine.
4fill in blank
hard

Fill both blanks to hide the top and right spines of the plot.

Matplotlib
ax.spines['[1]'].set_visible(False)
ax.spines['[2]'].set_visible(False)
Drag options to blanks, or click blank then click option'
Atop
Bbottom
Cright
Dleft
Attempts:
3 left
💡 Hint
Common Mistakes
Hiding bottom or left spines instead of top or right.
Using set_color instead of set_visible.
5fill in blank
hard

Fill all three blanks to create a spine chart with custom spine positions.

Matplotlib
ax.spines['left'].set_position(('[1]', [2]))
ax.spines['bottom'].set_position(('[3]', 0))
Drag options to blanks, or click blank then click option'
Aoutward
Baxes
Cdata
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect position types like 'left' or 'right'.
Forgetting to provide the numeric value for the position.