Function Repository Resource:

OverflowBarChart

Source Notebook

A version of BarChart that accommodates large outlier values

Contributed by: Jon McLoone

ResourceFunction["OverflowBarChart"][data]

creates a BarChart of data with large outliers clipped and styled.

Details and Options

By default, bars are clipped at twice the median value. This behavior can be modified using PlotRange.
The following options are supported:
"ArrowWidth"1the width of the overflow bars
"ArrowStyle"Automaticstyle primitives to apply to the overflow bars
"TaperRatio"0the proportion of arrows that are tapered
"ArrowheadProportion"Automaticthe proportion of the the overflow bar to be an Arrowhead
"LabelFunction"Automatica function for displaying the label in an overflow bar
"LabelPosition"0.85the proportian of the vertical distance where the label is placed
PlotRangeAutomaticthe range of y-values to include; larger values are clipped

Examples

Basic Examples (1) 

Display data in a BarChart with the outlier value clipped:

In[1]:=
ResourceFunction["OverflowBarChart"][{2, 3, 2, 29, 3}]
Out[1]=

Scope (1) 

Multidimensional data is supported:

In[2]:=
ResourceFunction[
 "OverflowBarChart"][{{2, 40}, {3, 1}, {2, 2}, {29, 3}, {3, 1}}]
Out[2]=

Options (5) 

By default, bars are clipped at twice the median value:

In[3]:=
ResourceFunction["OverflowBarChart"][{3, 3, 3, 29, 3}]
Out[3]=

If you set the PlotRange, this will be used instead:

In[4]:=
GraphicsGrid[{{ResourceFunction["OverflowBarChart"][{3, 3, 3, 29, 3}, PlotRange -> {0, 20}], ResourceFunction["OverflowBarChart"][{3, 3, 3, 29, 3}, PlotRange -> {0, 30}]}}]
Out[4]=

"ArrowStyle" allows style primitives to be applied to overflow bars:

In[5]:=
ResourceFunction["OverflowBarChart"][{3, 3, 3, 29, 3}, "ArrowStyle" -> Red]
Out[5]=

"LabelFunction" and "LabelPosition" can be used to control the label on the overflow bar:

In[6]:=
ResourceFunction["OverflowBarChart"][{3, 3, 3, 29, 3}, "LabelPosition" -> 0.5, "LabelFunction" -> (Style[Rotate[Round[#], Pi/2], "SmallText"] &)]
Out[6]=

The arrow style can be controlled with "TaperRatio", "ArrowheadProportion" and "ArrowWidth":

In[7]:=
ResourceFunction["OverflowBarChart"][{3, 3, 3, 29, 3}, "ArrowheadProportion" -> 0.3 , "ArrowWidth" -> 0.75, "TaperRatio" -> .3]
Out[7]=

Publisher

Jon McLoone

Version History

  • 1.0.0 – 31 May 2022

Related Resources

License Information