0
0
Data Analysis Pythondata~10 mins

Subplots for multiple charts in Data Analysis Python - Interactive Code Practice

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

Complete the code to create a figure and axes for subplots.

Data Analysis Python
fig, ax = plt.[1](1, 2)
Drag options to blanks, or click blank then click option'
Asubplots
Bfigure
Cplot
Dsubplot
Attempts:
3 left
💡 Hint
Common Mistakes
Using plt.subplot instead of plt.subplots
Using plt.plot which only creates a single plot
Using plt.figure which creates only the figure, no axes
2fill in blank
medium

Complete the code to plot a line chart on the first subplot.

Data Analysis Python
ax[[1]].plot(x, y1)
Drag options to blanks, or click blank then click option'
A2
B1
C0
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 instead of 0 for the first subplot
Using negative indices incorrectly
Using 2 when only two subplots exist
3fill in blank
hard

Fix the error in the code to set the title of the second subplot.

Data Analysis Python
ax[[1]].set_title('Second Plot')
Drag options to blanks, or click blank then click option'
A1
B0
C2
D-2
Attempts:
3 left
💡 Hint
Common Mistakes
Using 2 which is out of range
Using 0 which is the first subplot
Using negative indices incorrectly
4fill in blank
hard

Fill both blanks to create subplots with 2 rows and 1 column and plot on the first subplot.

Data Analysis Python
fig, ax = plt.subplots([1], [2])
ax[0].plot(x, y)
Drag options to blanks, or click blank then click option'
A2
B1
C3
D4
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping rows and columns
Using 3 or 4 which creates more subplots than needed
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps words to their lengths only if length is greater than 3.

Data Analysis Python
lengths = { [1]: [2] for [3] in words if len([1]) > 3 }
Drag options to blanks, or click blank then click option'
Aword
Blen(word)
Ditem
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently
Using len(word) as key instead of value
Not filtering words by length