0
0
Matplotlibdata~10 mins

Style sheets (ggplot, seaborn, dark_background) 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 apply the 'ggplot' style to matplotlib.

Matplotlib
import matplotlib.pyplot as plt
plt.style.use('[1]')
plt.plot([1, 2, 3], [4, 5, 6])
plt.show()
Drag options to blanks, or click blank then click option'
Aggplot
Bseaborn
Cdark_background
Dclassic
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'seaborn' instead of 'ggplot'.
Forgetting to call plt.style.use().
2fill in blank
medium

Complete the code to apply the 'seaborn' style to matplotlib.

Matplotlib
import matplotlib.pyplot as plt
plt.style.use('[1]')
plt.plot([1, 2, 3], [3, 2, 1])
plt.show()
Drag options to blanks, or click blank then click option'
Aclassic
Bggplot
Cseaborn
Ddark_background
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ggplot' instead of 'seaborn'.
Not importing matplotlib.pyplot as plt.
3fill in blank
hard

Fix the error in the code to apply the dark background style correctly.

Matplotlib
import matplotlib.pyplot as plt
plt.style.use('[1]')
plt.plot([1, 2, 3], [6, 5, 4])
plt.show()
Drag options to blanks, or click blank then click option'
Adark_background
Bdarkbackground
CDark_Background
Ddarkbackground_style
Attempts:
3 left
💡 Hint
Common Mistakes
Using camel case or missing underscore.
Using a style name that does not exist.
4fill in blank
hard

Fill both blanks to create a plot with 'seaborn' style and a title 'My Plot'.

Matplotlib
import matplotlib.pyplot as plt
plt.style.use('[1]')
plt.plot([1, 2, 3], [3, 4, 5])
plt.title('[2]')
plt.show()
Drag options to blanks, or click blank then click option'
Aseaborn
Bggplot
CMy Plot
DPlot Title
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up style names.
Forgetting to put the title string in quotes.
5fill in blank
hard

Fill both blanks to create a plot with 'ggplot' style, plot data, and label the y-axis as 'Value'.

Matplotlib
import matplotlib.pyplot as plt
plt.style.use('[1]')
plt.plot([1, 2, 3], [2, 4, 6])
plt.ylabel('[2]')
plt.show()
Drag options to blanks, or click blank then click option'
Adark_background
BValue
Cggplot
Dseaborn
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong style name.
Not setting the y-axis label correctly.