0
0
Matplotlibdata~10 mins

Markers on data points 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 plot data points with circle markers.

Matplotlib
import matplotlib.pyplot as plt
x = [1, 2, 3]
y = [4, 5, 6]
plt.plot(x, y, marker=[1])
plt.show()
Drag options to blanks, or click blank then click option'
A's'
B'x'
C'o'
D'^'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'x' instead of 'o' for circle markers.
2fill in blank
medium

Complete the code to plot data points with square markers.

Matplotlib
import matplotlib.pyplot as plt
x = [1, 2, 3]
y = [4, 5, 6]
plt.plot(x, y, marker=[1])
plt.show()
Drag options to blanks, or click blank then click option'
A's'
B'o'
C'd'
D'+'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'd' which is diamond, not square.
3fill in blank
hard

Fix the error in the code to plot data points with triangle up markers.

Matplotlib
import matplotlib.pyplot as plt
x = [1, 2, 3]
y = [4, 5, 6]
plt.plot(x, y, marker=[1])
plt.show()
Drag options to blanks, or click blank then click option'
A'v'
B'o'
C'x'
D'^'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'v' which is triangle down, not up.
4fill in blank
hard

Fill both blanks to create a plot with red diamond markers and dashed line style.

Matplotlib
import matplotlib.pyplot as plt
x = [1, 2, 3]
y = [4, 5, 6]
plt.plot(x, y, marker=[1], linestyle=[2], color='red')
plt.show()
Drag options to blanks, or click blank then click option'
A'd'
B'--'
C'-'
D':'
Attempts:
3 left
💡 Hint
Common Mistakes
Using solid line '-' instead of dashed '--'.
5fill in blank
hard

Fill all three blanks to create a plot with green plus markers, dotted line style, and linewidth 2.

Matplotlib
import matplotlib.pyplot as plt
x = [1, 2, 3]
y = [4, 5, 6]
plt.plot(x, y, marker=[1], linestyle=[2], linewidth=[3], color='green')
plt.show()
Drag options to blanks, or click blank then click option'
A'+'
B':'
C2
D'-'
Attempts:
3 left
💡 Hint
Common Mistakes
Using solid line '-' instead of dotted ':'.