Exercise: Multi-Line Plot with Legend
Add a second line to the plot using the provided data. Also add a legend to differentiate each line. Match the legend and line appearance in the expected output.
Expected:
![matplotlib expected figure](/exercise_basic_2_line_plot_with_legend.png)
Output:
import matplotlib.pyplot as plt
x = [0, 5, 10, 15, 20, 25]
y1 = [10, 4, 5, -5, 7, 15]
y2 = [-5, 14, 13, 0, -2, -3]
############## change here ###############
plt.plot(x, y1, linestyle='--', marker='D')
##########################################
plt.show()
Python
Setting up Python environment...
Output