I am trying to draw two data lines with error bars, each having the same color as the data line. However, I get another thin line with a color I have not specified in each data line when I add an error bar.
Also, I would like to make the caps of the error bars thicker but the option capthick is not valid here.
Could anybody please help me fix these issues?
This is my code.
import matplotlib.pyplot as plt from pylab import * import numpy as np xaxis = [1, 2, 3] mean1 = [1,2,3.6] se1 = [0.2, 0.5, 0.9] mean2 = [10, 29, 14] se2 = [3, 4, 2] fig = plt.figure() ax = fig.add_subplot(111) ax.set_xlabel('X', fontsize = 16) ax.set_ylabel('Y', fontsize = 16) ax.axis([0, 5, 0, 35]) ax.plot(xaxis, mean1, 'r--', linewidth = 4) ax.errorbar(xaxis, mean1, yerr = se1, ecolor = 'r', elinewidth = 2, capsize = 5) ax.plot(xaxis, mean2, 'b--', linewidth = 4) ax.errorbar(xaxis, mean2, yerr = se2, ecolor = 'b', elinewidth = 2, capsize = 5) plt.show()