Complete the code to create an error bar plot with y-error.
import matplotlib.pyplot as plt x = [1, 2, 3, 4] y = [2, 3, 5, 7] yerr = [0.2, 0.3, 0.1, 0.4] plt.errorbar(x, y, [1]=yerr) plt.show()
The yerr parameter specifies the error bars for the y-values in plt.errorbar.
Complete the code to add marker style 'o' to the error bar plot.
import matplotlib.pyplot as plt x = [1, 2, 3, 4] y = [2, 3, 5, 7] yerr = [0.2, 0.3, 0.1, 0.4] plt.errorbar(x, y, yerr=yerr, [1]='o') plt.show()
The marker parameter sets the style of the points in the plot, such as circles ('o').
Fix the error in the code to correctly plot horizontal error bars.
import matplotlib.pyplot as plt x = [1, 2, 3, 4] y = [2, 3, 5, 7] xerr = [0.1, 0.2, 0.1, 0.3] plt.errorbar(x, y, [1]=xerr) plt.show()
To add horizontal error bars, use the xerr parameter in plt.errorbar.
Fill both blanks to create an error bar plot with red color and dashed line style.
import matplotlib.pyplot as plt x = [1, 2, 3, 4] y = [2, 3, 5, 7] yerr = [0.2, 0.3, 0.1, 0.4] plt.errorbar(x, y, yerr=yerr, [1]=[2]) plt.show()
The color parameter sets the color of the plot, and '--' is the dashed line style.
Fill all three blanks to create an error bar plot with blue color, circle markers, and dotted line style.
import matplotlib.pyplot as plt x = [1, 2, 3, 4] y = [2, 3, 5, 7] yerr = [0.2, 0.3, 0.1, 0.4] plt.errorbar(x, y, yerr=yerr, [1]=[2], [3]='o') plt.show()
The color parameter sets the line color, 'blue' is the color value, and linestyle with ':' creates a dotted line. The marker='o' adds circle markers.