Вопрос

I want to adjust error bar properties in a bar plot. Apparently this is to be done by using keyword arguments (i.e. in error_kw). e.g.

from pylab import *

fig = figure()
ax  = fig.add_subplot(111)

ax.plot( left=0, width=1, height=5, error_kw=dict(elinewidth=3, ecolor='b') )

However, I cannot find a listing of the possible error_kw values.
I apologize in advance for asking such a trivial question, but I cannot find this anywhere and it drives me nuts.

Это было полезно?

Решение

See the parameters for matplotlib.pyplot.bar

Parameters: 
left : sequence of scalars

the x coordinates of the left sides of the bars

height : sequence of scalars

the heights of the bars

width : scalar or array-like, optional, default: 0.8

the width(s) of the bars

bottom : scalar or array-like, optional, default: None

the y coordinate(s) of the bars

color : scalar or array-like, optional

the colors of the bar faces

edgecolor : scalar or array-like, optional

the colors of the bar edges

linewidth : scalar or array-like, optional, default: None

width of bar edge(s). If None, use default linewidth; If 0, don’t draw edges.

xerr : scalar or array-like, optional, default: None

if not None, will be used to generate errorbar(s) on the bar chart

yerr :scalar or array-like, optional, default: None :

if not None, will be used to generate errorbar(s) on the bar chart

ecolor : scalar or array-like, optional, default: None

specifies the color of errorbar(s)

capsize : integer, optional, default: 3

determines the length in points of the error bar caps

error_kw : :

dictionary of kwargs to be passed to errorbar method. ecolor and capsize may be specified here rather than as independent kwargs.

align : [‘edge’ | ‘center’], optional, default: ‘edge’

If edge, aligns bars by their left edges (for vertical bars) and by their bottom edges (for horizontal bars). If center, interpret the left argument as the coordinates of the centers of the bars.

orientation : ‘vertical’ | ‘horizontal’, optional, default: ‘vertical’

The orientation of the bars.

log : boolean, optional, default: False

If true, sets the axis to be log scale

Другие советы

error_kw takes the same key words as errorbar.

See the current matplotlib docs for errorbar() for the arguments that may be used. In particular, the following should be accepted for the current version:

  • ecolor: The color of the errorbar lines. If None, use the color of the line connecting the markers.
  • elinewidth: The linewidth of the errorbar lines. If None, the linewidth of the current style is used.
  • capsize: The length of the error bar caps in points.
  • capthick: An alias to the keyword argument markeredgewidth (a.k.a. mew). This setting is a more sensible name for the property that controls the thickness of the error bar cap in points. For backwards compatibility, if mew or markeredgewidth are given, then they will over-ride capthick. This may change in future releases.
  • barsabove: If True, will plot the errorbars above the plot symbols. Default is below.
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top