Recall & Review
beginner
What does the
plt.fill_between function do in matplotlib?It fills the area between two horizontal curves or between a curve and a baseline, creating an area chart.
Click to reveal answer
beginner
Which parameters are essential for
plt.fill_between to create an area chart?The x values, the y1 values (top curve), and optionally y2 values (bottom curve or baseline).
Click to reveal answer
beginner
How can you change the color and transparency of the filled area in
plt.fill_between?Use the
color parameter to set the fill color and alpha to adjust transparency (0 to 1).Click to reveal answer
beginner
Why might you use an area chart instead of a line chart?
Area charts emphasize the magnitude of values over time or categories by filling the space under the line, making it easier to see volume or totals.
Click to reveal answer
beginner
What happens if you only provide one y array to
plt.fill_between?It fills the area between the y values and the x-axis (baseline at y=0).
Click to reveal answer
What is the default baseline when using
plt.fill_between(x, y)?✗ Incorrect
If only one y array is given, the area is filled between y and the x-axis (y=0).
Which parameter controls the transparency of the filled area in
plt.fill_between?✗ Incorrect
The
alpha parameter sets transparency, where 0 is fully transparent and 1 is fully opaque.What type of chart does
plt.fill_between help create?✗ Incorrect
plt.fill_between fills the area under a curve, making an area chart.If you want to fill between two curves y1 and y2, how do you call
plt.fill_between?✗ Incorrect
You provide x, y1 (top curve), and y2 (bottom curve) to fill the area between them.
Which of these is NOT a valid use of
plt.fill_between?✗ Incorrect
plt.fill_between is not used for scatter plots; it fills areas between curves.Explain how to create a simple area chart using
plt.fill_between with example data.Think about how you fill the area under a line using x and y arrays.
You got /4 concepts.
Describe the difference between a line chart and an area chart created with
plt.fill_between.Consider what the filled area adds visually compared to just a line.
You got /3 concepts.