Complete the code to import the plotting library needed for before-after comparison plots.
import [1] as plt
We use matplotlib.pyplot to create plots including before-after comparison plots.
Complete the code to create a figure and axis for plotting before-after data.
fig, [1] = plt.subplots()The subplots() function returns a figure and an axis object. The axis is used to draw plots.
Fix the error in the code to plot before and after values as connected points.
axis.plot(['Before', 'After'], [before_value, after_value], marker=[1])
The marker style must be a string like 'o' to show points on the plot.
Fill both blanks to add labels and a title to the before-after plot.
axis.set_xlabel([1]) axis.set_title([2])
The x-axis label should describe the time points, and the title should describe the plot purpose.
Fill all three blanks to create a dictionary comprehension that maps each time point to its value if the value increased.
result = [1]: [2] for [3] in ['Before', 'After'] if values[[3]] > values['Before']
The comprehension creates a dictionary with keys as time points and values as their corresponding values if they increased from 'Before'.