0
0
Matplotlibdata~10 mins

Why 3D visualization matters in Matplotlib - Test Your Understanding

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

Complete the code to import the 3D plotting toolkit from matplotlib.

Matplotlib
from mpl_toolkits.mplot3d import [1]
Drag options to blanks, or click blank then click option'
AAxes3D
Bplot3d
Cplot2d
DAxes2D
Attempts:
3 left
💡 Hint
Common Mistakes
Using 2D plotting modules instead of 3D.
Misspelling the module name.
2fill in blank
medium

Complete the code to create a 3D subplot in matplotlib.

Matplotlib
fig = plt.figure()
ax = fig.add_subplot(111, projection=[1])
Drag options to blanks, or click blank then click option'
A'2d'
B'3D'
C'3d'
D'xyz'
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase '3D' which causes errors.
Using '2d' projection for 3D plots.
3fill in blank
hard

Fix the error in the code to plot 3D scatter points.

Matplotlib
ax.scatter([1], y, z)
Drag options to blanks, or click blank then click option'
Ax
Bz
Cy
Dscatter
Attempts:
3 left
💡 Hint
Common Mistakes
Using y or z twice instead of x.
Passing the function name instead of data.
4fill in blank
hard

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

Matplotlib
{word: [1] for word in words if [2]
Drag options to blanks, or click blank then click option'
Alen(word)
Blen(word) > 3
Cword > 3
Dlen(words)
Attempts:
3 left
💡 Hint
Common Mistakes
Comparing word string directly to number.
Using len(words) instead of len(word).
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase words to their counts only if count is greater than zero.

Matplotlib
result = [1]: [2] for [3] in data.items() if [2] > 0}
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
Ck
Ddata
Attempts:
3 left
💡 Hint
Common Mistakes
Using data instead of k or v.
Not converting keys to uppercase.