indicate_error

indicate_error(self, *args, mean=None, means=None, median=None, medians=None, barstd=None, barstds=None, barpctile=None, barpctiles=None, bardata=None, boxstd=None, boxstds=None, boxpctile=None, boxpctiles=None, boxdata=None, shadestd=None, shadestds=None, shadepctile=None, shadepctiles=None, shadedata=None, fadestd=None, fadestds=None, fadepctile=None, fadepctiles=None, fadedata=None, boxmarker=None, boxmarkercolor='white', boxcolor=None, barcolor=None, shadecolor=None, fadecolor=None, shadelabel=False, fadelabel=False, shadealpha=0.4, fadealpha=0.2, boxlinewidth=None, boxlw=None, barlinewidth=None, barlw=None, capsize=None, boxzorder=2.5, barzorder=2.5, shadezorder=1.5, fadezorder=1.5, **kwargs)[source]

Adds support for drawing error bars and error shading on-the-fly. Includes options for interpreting columns of data as samples, representing the mean or median of each sample with lines, points, or bars, and drawing error bars representing percentile ranges or standard deviation multiples for each sample. Also supports specifying error bar data explicitly.

Important

This function wraps plot, plotx, scatter, scatterx, bar, barh, and violinplot.

Parameters
  • *args – The input data.

  • mean, means (bool, optional) – Whether to plot the means of each column in the input data. If no other arguments specified, this also sets barstd=True (and boxstd=True for violin plots).

  • median, medians (bool, optional) – Whether to plot the medians of each column in the input data. If no other arguments specified, this also sets barstd=True (and boxstd=True for violin plots).

  • barstd, barstds (float, (float, float), or bool, optional) – Standard deviation multiples for thin error bars with optional whiskers (i.e. caps). If scalar, then +/- that number is used. If True, the default of +/-3 standard deviations is used. This argument is only valid if means or medians is True.

  • barpctile, barpctiles (float, (float, float) or bool, optional) – As with barstd, but instead using percentiles for the error bars. The percentiles are calculated with numpy.percentile. If scalar, that width surrounding the 50th percentile is used (e.g. 90 shows the 5th to 95th percentiles). If True, the default percentile range of 0 to 100 is used. This argument is only valid if means or medians is True.

  • bardata (2 x N array or 1D array, optional) – If shape is 2 x N these are the lower and upper bounds for the thin error bars. If array is 1D these are the absolute, symmetric deviations from the central points. This should be used if means and medians are both False (i.e. you did not provide dataset columns from which statistical properties can be calculated automatically).

  • boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with barstd, barpctile, and bardata, but for thicker error bars representing a smaller interval than the thin error bars. If boxstds is True, the default standard deviation range of +/-1 is used. If boxpctiles is True, the default percentile range of 25 to 75 is used (i.e. the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.

  • shadestd, shadestds, shadepctile, shadepctiles, shadedata (optional) – As with barstd, barpctile, and bardata, but using shading to indicate the error range. If shadestds is True, the default standard deviation range of +/-2 is used. If shadepctiles is True, the default percentile range of 10 to 90 is used. Shading is generally useful for plot plots.

  • fadestd, fadestds, fadepctile, fadepctiles, fadedata (optional) – As with shadestd, shadepctile, and shadedata, but for an additional, more faded, secondary shaded region. If fadestds is True, the default standard deviation range of +/-3 is used. If fadepctiles is True, the default percentile range of 0 to 100 is used.

  • barcolor, boxcolor, shadecolor, fadecolor (color-spec, optional) – Colors for the different error indicators. For error bars, the default is 'k'. For shading, the default behavior is to inherit color from the primary Artist.

  • shadelabel, fadelabel (bool or str, optional) – Labels for the shaded regions to be used as separate legend entries. To toggle labels “on” and apply a default label, use e.g. shadelabel=True. To apply a custom label, use e.g. shadelabel='label'. Otherwise, the shading is drawn underneath the line and/or marker in the legend entry.

  • barlinewidth, boxlinewidth, barlw, boxlw (float, optional) – Line widths for the thin and thick error bars, in points. The defaults are barlw=0.8 and boxlw=4 * barlw.

  • boxmarker (bool, optional) – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored if boxes is False.

  • boxmarkercolor (color-spec, optional) – Color for the boxmarker marker. Default is 'w'.

  • capsize (float, optional) – The cap size for thin error bars in points.

  • barzorder, boxzorder, shadezorder, fadezorder (float, optional) – The “zorder” for the thin error bars, thick error bars, and shading.

Returns

h, err1, err2, … – The original plot object and the error bar or shading objects.