Matplotlib.axes.Axes.errorbar() in Python Last Updated : 28 Apr, 2025 Comments Improve Suggest changes Like Article Like Report Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute. Example: Python3 # Implementation of matplotlib function import matplotlib.pyplot as plt import numpy as np # make an agg figure fig, ax = plt.subplots() ax.plot([1, 2, 3]) ax.set_title('matplotlib.axes.Axes.plot() example 1') fig.canvas.draw() plt.show() Output: matplotlib.axes.Axes.errorbar() Function The Axes.errorbar() function in axes module of matplotlib library is used to plot y versus x as lines and/or markers with attached errorbars. Syntax: Axes.errorbar(self, x, y, yerr=None, xerr=None, fmt='', ecolor=None, elinewidth=None, capsize=None, barsabove=False, lolims=False, uplims=False, xlolims=False, xuplims=False, errorevery=1, capthick=None, *, data=None, **kwargs) Parameters: This method accept the following parameters that are described below: x, y: These parameter are the horizontal and vertical coordinates of the data points.fmt: This parameter is an optional parameter and it contains the string value.xerr, yerr: These parameter contains an array.And the error array should have positive values.ecolor: This parameter is an optional parameter. And it is the color of the errorbar lines with default value NONE.elinewidth: This parameter is also an optional parameter. And it is the linewidth of the errorbar lines with default value NONE.capsize: This parameter is also an optional parameter. And it is the length of the error bar caps in points with default value NONE.barsabove: This parameter is also an optional parameter. It contains boolean value True for plotting errorbars above the plot symbols.Its default value is False.lolims, uplims, xlolims, xuplims: These parameter are also an optional parameter. They contain boolean values which is used to indicate that a value gives only upper/lower limits.errorevery: This parameter is also an optional parameter. They contain integer values which is used to draws error bars on a subset of the data. Returns: This returns the container and it is comprises of the following: plotline:This returns the Line2D instance of x, y plot markers and/or line.caplines:This returns the tuple of Line2D instances of the error bar caps.barlinecols:This returns the tuple of LineCollection with the horizontal and vertical error ranges. Below examples illustrate the matplotlib.axes.Axes.errorbar() function in matplotlib.axes: Example #1: Python3 # Implementation of matplotlib function import numpy as np import matplotlib.pyplot as plt # example data xval = np.arange(0.1, 4, 0.5) yval = np.exp(-xval) fig, ax = plt.subplots() ax.errorbar(xval, yval, xerr = 0.4, yerr = 0.5) plt.show() Output: Example #2: Python3 # Implementation of matplotlib function import numpy as np import matplotlib.pyplot as plt fig = plt.figure() x = np.arange(10) y = 3 * np.sin(x / 20 * np.pi) yerr = np.linspace(0.05, 0.2, 10) plt.errorbar(x, y + 7, yerr = yerr, label ='Line1') plt.errorbar(x, y + 5, yerr = yerr, uplims = True, label ='Line2') plt.errorbar(x, y + 3, yerr = yerr, uplims = True, lolims = True, label ='Line3') upperlimits = [True, False] * 5 lowerlimits = [False, True] * 5 plt.errorbar(x, y, yerr = yerr, uplims = upperlimits, lolims = lowerlimits, label ='Line4') plt.legend(loc ='upper left') plt.show() Output: Comment More infoAdvertise with us Next Article Matplotlib.axes.Axes.errorbar() in Python S SHUBHAMSINGH10 Follow Improve Article Tags : Python Python-matplotlib Practice Tags : python Similar Reads Matplotlib.axes.Axes.bar() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute. 2 min read matplotlib.axes.Axes.barh() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute. 2 min read Matplotlib.axes.Axes.barbs() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute. 2 min read Matplotlib.axes.Axes.draw() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute. 2 min read Matplotlib.axes.Axes.bxp() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute. 3 min read Matplotlib.axes.Axes.cla() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute. 1 min read Matplotlib.axes.Axes.axis() in Python The Axes.axis() function in Matplotlib is used to get or set the properties of the x-axis and y-axis limits on a given Axes object. It provides an easy way to control the view limits, aspect ratio, and visibility of the axes in a plot. It's key feature include:Get the current axis limits as [xmin, x 2 min read Matplotlib.axes.Axes.grid() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute. 2 min read Matplotlib.axes.Axes.format_coord() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute. 2 min read Matplotlib.axes.Axes.broken_barh() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute. 2 min read Like