0
0
Matplotlibdata~10 mins

3D plot limitations and alternatives 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 3D plotting toolkit from matplotlib.

Matplotlib
from mpl_toolkits.mplot3d import [1]
Drag options to blanks, or click blank then click option'
AAxes2D
Bplot3d
CAxes3D
Dplot2d
Attempts:
3 left
💡 Hint
Common Mistakes
Using plot3d which does not exist.
Confusing 2D and 3D plotting modules.
2fill in blank
medium

Complete the code to create a 3D scatter plot using matplotlib.

Matplotlib
ax = fig.add_subplot(111, projection=[1])
ax.scatter(x, y, z)
Drag options to blanks, or click blank then click option'
A'3d'
B'scatter'
C'2d'
D'plot3d'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '2d' projection for 3D plots.
Passing 'scatter' as projection which is invalid.
3fill in blank
hard

Fix the error in the code to correctly set axis labels for a 3D plot.

Matplotlib
ax.set_xlabel('X axis')
ax.set_ylabel('Y axis')
ax.[1]('Z axis')
Drag options to blanks, or click blank then click option'
Aset_z_axis
Bset_z
Clabel_z
Dset_zlabel
Attempts:
3 left
💡 Hint
Common Mistakes
Using set_z_axis which does not exist.
Trying to use label_z which is invalid.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that filters points with z > 0 and squares x values.

Matplotlib
filtered_points = {x: x[1]2 for x, z in points.items() if z [2] 0}
Drag options to blanks, or click blank then click option'
A**
B>
C<
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using * instead of ** for squaring.
Using < instead of > for filtering.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that converts keys to uppercase, keeps values, and filters values > 10.

Matplotlib
result = [1]: [2] for k, v in data.items() if v [3] 10}
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
C>
Dk.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using k.lower() instead of k.upper().
Using < instead of > for filtering.