---
title: "RectangleChart"
language: "en"
type: "Symbol"
summary: "RectangleChart[{{x1, y1}, {x2, y2}, ...}] makes a rectangle chart with bars of width xi and height yi. RectangleChart[{..., wi[{xi, yi}, ...], ..., wj[{xi, yj}, ...], ...}] makes a rectangle chart with bar features defined by the symbolic wrappers wk. RectangleChart[{data1, data2, ...}] makes a rectangle chart from multiple datasets datai."
keywords: 
- age and sex pyramid
- area graph
- bar chart
- bar graph
- barchart
- bar and symbol graph
- box whisker graph
- box whisker chart
- horizontal bar chart
- vertical bar chart
- column graph
- grouped bar chart
- range graph
- overlapped bar chart
- linked bar chart
- candle stick graph
- candle stick chart
- pictogram
- 100% stacked bar chart
- 100% stacked bar diagram
- 100% stacked bar graph
- 100% stacked bar plot
- 100% stacked column chart
- 100% stacked column diagram
- 100% stacked column graph
- 100% stacked column plot
- bilateral bar chart
- bilateral bar diagram
- bilateral bar graph
- bilateral bar plot
- bilateral column chart
- bilateral column diagram
- bilateral column graph
- bilateral column plot
- deviation bar chart
- deviation bar diagram
- deviation bar graph
- deviation bar plot
- deviation column chart
- deviation column diagram
- deviation column graph
- deviation column plot
- difference bar chart
- difference bar diagram
- difference bar graph
- difference bar plot
- difference column chart
- difference column diagram
- difference column graph
- difference column plot
- grouped bar diagram
- grouped bar graph
- grouped bar plot
- grouped column chart
- grouped column diagram
- grouped column graph
- grouped column plot
- horizontal bar diagram
- horizontal bar graph
- horizontal bar plot
- horizontal column chart
- horizontal column diagram
- horizontal column graph
- horizontal column plot
- opposed bar chart
- opposed bar diagram
- opposed bar graph
- opposed bar plot
- opposed column chart
- opposed column diagram
- opposed column graph
- opposed column plot
- overlapped bar diagram
- overlapped bar graph
- overlapped bar plot
- overlapped column chart
- overlapped column diagram
- overlapped column graph
- overlapped column plot
- paired bar chart
- paired bar diagram
- paired bar graph
- paired bar plot
- paired column chart
- paired column diagram
- paired column graph
- paired column plot
- percentage bar chart
- percentage bar diagram
- percentage bar graph
- percentage bar plot
- percentage column chart
- percentage column diagram
- percentage column graph
- percentage column plot
- percent of the whole bar chart
- percent of the whole bar diagram
- percent of the whole bar graph
- percent of the whole bar plot
- percent of the whole column chart
- percent of the whole column diagram
- percent of the whole column graph
- percent of the whole column plot
- pictorial bar chart
- pictorial bar diagram
- pictorial bar graph
- pictorial bar plot
- pictorial column chart
- pictorial column diagram
- pictorial column graph
- pictorial column plot
- progressive bar chart
- progressive bar diagram
- progressive bar graph
- progressive bar plot
- progressive column chart
- progressive column diagram
- progressive column graph
- progressive column plot
- range bar chart
- range bar diagram
- range bar graph
- range bar plot
- range column chart
- range column diagram
- range column graph
- range column plot
- rotated bar chart
- rotated bar diagram
- rotated bar graph
- rotated bar plot
- rotated column chart
- rotated column diagram
- rotated column graph
- rotated column plot
- sliding bar chart
- sliding bar diagram
- sliding bar graph
- sliding bar plot
- sliding column chart
- sliding column diagram
- sliding column graph
- sliding column plot
- stacked bar chart
- stacked bar diagram
- stacked bar graph
- stacked bar plot
- stacked column chart
- stacked column diagram
- stacked column graph
- stacked column plot
- two-way bar chart
- two-way bar diagram
- two-way bar graph
- two-way bar plot
- two-way column chart
- two-way column diagram
- two-way column graph
- two-way column plot
- vertical bar diagram
- vertical bar graph
- vertical bar plot
- vertical column chart
- vertical column diagram
- vertical column graph
- vertical column plot
canonical_url: "https://reference.wolfram.com/language/ref/RectangleChart.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Charting and Information Visualization"
    link: "https://reference.wolfram.com/language/guide/ChartingAndInformationVisualization.en.md"
related_functions: 
  - 
    title: "Histogram"
    link: "https://reference.wolfram.com/language/ref/Histogram.en.md"
  - 
    title: "RectangleChart3D"
    link: "https://reference.wolfram.com/language/ref/RectangleChart3D.en.md"
  - 
    title: "BarChart3D"
    link: "https://reference.wolfram.com/language/ref/BarChart3D.en.md"
  - 
    title: "BubbleChart"
    link: "https://reference.wolfram.com/language/ref/BubbleChart.en.md"
  - 
    title: "SectorChart"
    link: "https://reference.wolfram.com/language/ref/SectorChart.en.md"
  - 
    title: "ListPlot"
    link: "https://reference.wolfram.com/language/ref/ListPlot.en.md"
  - 
    title: "ListLinePlot"
    link: "https://reference.wolfram.com/language/ref/ListLinePlot.en.md"
  - 
    title: "ListLogPlot"
    link: "https://reference.wolfram.com/language/ref/ListLogPlot.en.md"
  - 
    title: "PairedBarChart"
    link: "https://reference.wolfram.com/language/ref/PairedBarChart.en.md"
  - 
    title: "Rectangle"
    link: "https://reference.wolfram.com/language/ref/Rectangle.en.md"
---
# RectangleChart

RectangleChart[{{x1, y1}, {x2, y2}, …}] makes a rectangle chart with bars of width xi and height yi. 

RectangleChart[{…, wi[{xi, yi}, …], …, wj[{xi, yj}, …], …}] makes a rectangle chart with bar features defined by the symbolic wrappers wk.

RectangleChart[{data1, data2, …}] makes a rectangle chart from multiple datasets datai.

## Details and Options

* Data elements for ``RectangleChart`` can be given in the following forms:

|                                      |                                          |
| ------------------------------------ | ---------------------------------------- |
| {xi, yi}                             | pure bar width and height                |
| {Quantity[xi, ux], Quantity[yi, uy]} | bar width and height with units          |
| wi[{xi, yi}, …]                      | a bar with size {xi, yi} and wrapper wi  |
| formi -> mi                          | a bar form with metadata mi              |

* Data not given in these forms is ignored in forming the rectangle chart.

* Datasets for ``RectangleChart`` can be given in the following forms:

|                                                |                                              |
| ---------------------------------------------- | -------------------------------------------- |
| {e1, e2, …}                                    | list of elements with or without wrappers    |
| <\|k1 -> {x1, y1}, k2 -> {x2, y2}, …\|>          | association of keys and values               |
| TimeSeries[…], EventSeries[…], TemporalData[…] | time series, event series, and temporal data |
| WeightedData[…]                                | augmented datasets                           |
| w[{e1, e2, …}, …]                              | wrapper applied to a whole dataset           |
| w[{data1, data2, …}, …]                        | wrapper applied to all datasets              |

* ``RectangleChart[Tabular[…] -> cspec]`` extracts and plots values from the tabular object using the column specification ``cspec``.

* The following forms of column specifications ``cspec`` are allowed for plotting tabular data:

|                                     |                                                    |
| ----------------------------------- | -------------------------------------------------- |
| {colx, coly}                        | plot column y against column x                     |
| {{colx1, coly1}, {colx2, coly2}, …} | plot column y1 against column x1, y2 against x2, … |

* The following wrappers can be used for chart elements:

|                      |                                                            |
| -------------------- | ---------------------------------------------------------- |
| Annotation[e, label] | provide an annotation                                      |
| Button[e, action]    | define an action to execute when the element is clicked    |
| Callout[e, label]    | display the element with a callout                         |
| EventHandler[e, …]   | define a general event handler for the element             |
| Hyperlink[e, uri]    | make the element act as a hyperlink                        |
| Labeled[e, …]        | display the element with labeling                          |
| Legended[e, …]       | include features of the element in a chart legend          |
| Mouseover[e, over]   | make the element show a mouseover form                     |
| PopupWindow[e, cont] | attach a popup window to the element                       |
| StatusArea[e, label] | display in the status area when the element is moused over |
| Style[e, opts]       | show the element using the specified styles                |
| Tooltip[e, label]    | attach an arbitrary tooltip to the element                 |

* In ``RectangleChart``, ``Labeled``, ``Callout`` and ``Placed`` allow the following positions:

|                                  |                                                                              |
| -------------------------------- | ---------------------------------------------------------------------------- |
| Top, Bottom, Left, Right, Center | positions within bars                                                        |
| Above, Below, Before, After      | positions outside bars                                                       |
| Axis                             | on the bar origin axis                                                       |
| {{bx, by}, {lx, ly}}             | scaled position {lx, ly} in the label at scaled position {bx, by} in the bar |

* ``RectangleChart`` has the same options as ``Graphics`` with the following additions and changes: []

|                       |                     |                                                 |
| --------------------- | ------------------- | ----------------------------------------------- |
| AspectRatio           | 1 / GoldenRatio     | overall ratio of height to width                |
| Axes                  | True                | whether to draw axes                            |
| BarOrigin             | Bottom              | origin of bars                                  |
| BarSpacing            | Automatic           | spacing between bars                            |
| ChartBaseStyle        | Automatic           | overall style for bars                          |
| ChartElements         | Automatic           | graphics to use for each of the bars            |
| ChartElementFunction  | Automatic           | how to generate raw graphics for bars           |
| ChartLabels           | None                | labels for data elements and datasets           |
| ChartLayout           | Automatic           | overall layout to use                           |
| ChartLegends          | None                | legends for data elements and datasets          |
| ChartStyle            | Automatic           | style for bars                                  |
| ColorFunction         | Automatic           | how to color bars                               |
| ColorFunctionScaling  | True                | whether to normalize arguments to ColorFunction |
| LabelingFunction      | Automatic           | how to label bars                               |
| LabelingSize          | Automatic           | maximum size of callouts and labels             |
| LegendAppearance      | Automatic           | overall appearance of legends                   |
| PerformanceGoal       | \$PerformanceGoal   | aspects of performance to try to optimize       |
| PlotInteractivity     | \$PlotInteractivity | whether to allow interactive elements           |
| PlotTheme             | \$PlotTheme         | overall theme for the chart                     |
| ScalingFunctions      | None                | how to scale individual coordinates             |
| TargetUnits           | Automatic           | units to display in the chart                   |

* The following settings for ``ChartLayout`` can be used to display multiple sets of data:

|         |           |                                                   |
| ------- | --------- | ------------------------------------------------- |
| [image] | "Grouped" | separate the data for each dataset                |
| [image] | "Stepped" | accumulate and separate the data for each dataset |

* Possible settings for ``ChartLayout`` that show individual datasets in different panels include:

|                                       |                                           |
| ------------------------------------- | ----------------------------------------- |
| "Column"                              | use separate charts in a column of panels |
| "Row"                                 | use separate charts in a row of panels    |
| {"Column", k}, {"Row", k}             | use k columns or rows                     |
| {"Column", UpTo[k]}, {"Row", UpTo[k]} | use at most k columns or rows             |

[image]

* The arguments supplied to ``ChartElementFunction`` are the bar region ``{{xmin, xmax}, {ymin, ymax}}``, the data value ``{xi, yi}``, and metadata ``{m1, m2, …}`` from each level in a nested list of datasets.

* A list of built-in settings for ``ChartElementFunction`` can be obtained from ``ChartElementData["RectangleChart"]``.

* The arguments supplied to ``ColorFunction`` consist of ``xi`` and ``yi``.

* Style and other specifications from options and other constructs in ``RectangleChart`` are effectively applied in the order ``ChartStyle``, ``ColorFunction``, ``Style`` and other wrappers, ``ChartElements``, and ``ChartElementFunction``, with later specifications overriding earlier ones.

### List of all options

|                        |                     |                                                                                    |
| ---------------------- | ------------------- | ---------------------------------------------------------------------------------- |
| AlignmentPoint         | Center              | the default point in the graphic to align with                                     |
| AspectRatio            | 1 / GoldenRatio     | overall ratio of height to width                                                   |
| Axes                   | True                | whether to draw axes                                                               |
| AxesLabel              | None                | axes labels                                                                        |
| AxesOrigin             | Automatic           | where axes should cross                                                            |
| AxesStyle              | {}                  | style specifications for the axes                                                  |
| Background             | None                | background color for the plot                                                      |
| BarOrigin              | Bottom              | origin of bars                                                                     |
| BarSpacing             | Automatic           | spacing between bars                                                               |
| BaselinePosition       | Automatic           | how to align with a surrounding text baseline                                      |
| BaseStyle              | {}                  | base style specifications for the graphic                                          |
| ChartBaseStyle         | Automatic           | overall style for bars                                                             |
| ChartElementFunction   | Automatic           | how to generate raw graphics for bars                                              |
| ChartElements          | Automatic           | graphics to use for each of the bars                                               |
| ChartLabels            | None                | labels for data elements and datasets                                              |
| ChartLayout            | Automatic           | overall layout to use                                                              |
| ChartLegends           | None                | legends for data elements and datasets                                             |
| ChartStyle             | Automatic           | style for bars                                                                     |
| ColorFunction          | Automatic           | how to color bars                                                                  |
| ColorFunctionScaling   | True                | whether to normalize arguments to ColorFunction                                    |
| ContentSelectable      | Automatic           | whether to allow contents to be selected                                           |
| CoordinatesToolOptions | Automatic           | detailed behavior of the coordinates tool                                          |
| Epilog                 | {}                  | primitives rendered after the main plot                                            |
| FormatType             | TraditionalForm     | the default format type for text                                                   |
| Frame                  | False               | whether to put a frame around the plot                                             |
| FrameLabel             | None                | frame labels                                                                       |
| FrameStyle             | {}                  | style specifications for the frame                                                 |
| FrameTicks             | Automatic           | frame ticks                                                                        |
| FrameTicksStyle        | {}                  | style specifications for frame ticks                                               |
| GridLines              | None                | grid lines to draw                                                                 |
| GridLinesStyle         | {}                  | style specifications for grid lines                                                |
| ImageMargins           | 0.                  | the margins to leave around the graphic                                            |
| ImagePadding           | All                 | what extra padding to allow for labels etc.                                        |
| ImageSize              | Automatic           | the absolute size at which to render the graphic                                   |
| LabelingFunction       | Automatic           | how to label bars                                                                  |
| LabelingSize           | Automatic           | maximum size of callouts and labels                                                |
| LabelStyle             | {}                  | style specifications for labels                                                    |
| LegendAppearance       | Automatic           | overall appearance of legends                                                      |
| Method                 | Automatic           | details of graphics methods to use                                                 |
| PerformanceGoal        | \$PerformanceGoal   | aspects of performance to try to optimize                                          |
| PlotInteractivity      | \$PlotInteractivity | whether to allow interactive elements                                              |
| PlotLabel              | None                | an overall label for the plot                                                      |
| PlotRange              | All                 | range of values to include                                                         |
| PlotRangeClipping      | False               | whether to clip at the plot range                                                  |
| PlotRangePadding       | Automatic           | how much to pad the range of values                                                |
| PlotRegion             | Automatic           | the final display region to be filled                                              |
| PlotTheme              | \$PlotTheme         | overall theme for the chart                                                        |
| PreserveImageOptions   | Automatic           | whether to preserve image options when displaying new versions of the same graphic |
| Prolog                 | {}                  | primitives rendered before the main plot                                           |
| RotateLabel            | True                | whether to rotate y labels on the frame                                            |
| ScalingFunctions       | None                | how to scale individual coordinates                                                |
| TargetUnits            | Automatic           | units to display in the chart                                                      |
| Ticks                  | Automatic           | axes ticks                                                                         |
| TicksStyle             | {}                  | style specifications for axes ticks                                                |

---

## Examples (155)

### Basic Examples (4)

Generate a rectangle chart for a list of width and height pairs:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}]

Out[1]= [image]
```

---

Multiple datasets:

```wl
In[1]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{3, 2}, {1, 3}, {2, 1}}}]

Out[1]= [image]
```

Show multiple sets as a row of charts:

```wl
In[2]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{3, 2}, {1, 3}, {2, 1}}}, ChartLayout -> "Row"]

Out[2]= [image]
```

---

Use categorical labels:

```wl
In[1]:= data = {{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}};

In[2]:= RectangleChart[data, ChartLabels -> {"a", "b", "c"}]

Out[2]= [image]
```

Categorical legends:

```wl
In[3]:= RectangleChart[data, ChartLegends -> {"a", "b", "c"}]

Out[3]= [image]
```

---

Set the style for bars:

```wl
In[1]:= RectangleChart[Tuples[{1, 2}, 2], ChartStyle -> "DarkRainbow"]

Out[1]= [image]
```

Pictorial bars:

```wl
In[2]:= RectangleChart[Tuples[{1, 2}, 2], ChartElements -> {[image], {All, 1}}]

Out[2]= [image]
```

Procedural bars:

```wl
In[3]:= RectangleChart[Tuples[{1, 2}, 2], ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]

Out[3]= [image]
```

### Scope (41)

#### Data and Layouts (13)

Items in a dataset are grouped together:

```wl
In[1]:= RectangleChart[{{{1, 1}, {1, 1}, {1, 1}}, {{2, 2}, {2, 2}, {2, 2}}}]

Out[1]= [image]
```

---

Datasets do not need to have the same number of items:

```wl
In[1]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}]

Out[1]= [image]
```

---

Non-real data is taken to be missing:

```wl
In[1]:= RectangleChart[{{{1, 1}, Missing[], {1, 1}, {1, 1}}, {{2, 2}, 1 + I, {2, 2}}, {foo, {3, 3}}}]

Out[1]= [image]
```

---

The data may include units:

```wl
In[1]:= RectangleChart[{{Quantity[3, "Seconds"], Quantity[2, "Meters"]}, {Quantity[8, "Seconds"], Quantity[5, "Meters"]}, {Quantity[2, "Seconds"], Quantity[3, "Meters"]}, {Quantity[1, "Seconds"], Quantity[3, "Meters"]}, {Quantity[8, "Seconds"], Quantity[7, "Meters"]}, {Quantity[7, "Seconds"], Quantity[1, "Meters"]}}, AxesLabel -> Automatic, BarSpacing -> None, Ticks -> True]

Out[1]= [image]
```

---

Specify the units to use:

```wl
In[1]:= RectangleChart[{{Quantity[3, "Seconds"], Quantity[2, "Meters"]}, {Quantity[8, "Seconds"], Quantity[5, "Meters"]}, {Quantity[2, "Seconds"], Quantity[3, "Meters"]}, {Quantity[1, "Seconds"], Quantity[3, "Meters"]}, {Quantity[8, "Seconds"], Quantity[7, "Meters"]}, {Quantity[7, "Seconds"], Quantity[1, "Meters"]}}, AxesLabel -> Automatic, BarSpacing -> None, Ticks -> True, TargetUnits -> {"Minutes", "Feet"}]

Out[1]= [image]
```

---

The time stamps in ``TimeSeries``, ``EventSeries``, and ``TemporalData`` are ignored:

```wl
In[1]:= RectangleChart[TimeSeries[{{19, 16}, {9, 3}, {7, 2}, {17, 5}}, {"May 24, 1982"}]]

Out[1]= [image]
```

---

The values in associations are taken as the dimensions of the bars:

```wl
In[1]:= RectangleChart[<|"a" -> {1, 1}, "b" -> {1, 2}, "c" -> {2, 1}, "d" -> {2, 2}|>]

Out[1]= [image]
```

Use the keys as labels:

```wl
In[2]:= RectangleChart[<|"a" -> {1, 1}, "b" -> {1, 2}, "c" -> {2, 1}, "d" -> {2, 2}|>, ChartLabels -> Automatic]

Out[2]= [image]
```

Use the keys as callouts:

```wl
In[3]:= RectangleChart[<|"a" -> {1, 1}, "b" -> {1, 2}, "c" -> {2, 1}, "d" -> {2, 2}|>, ChartLabels -> Callout[Automatic, Above]]

Out[3]= [image]
```

Use the keys as legends:

```wl
In[4]:= RectangleChart[<|"a" -> {1, 1}, "b" -> {1, 2}, "c" -> {2, 1}, "d" -> {2, 2}|>, ChartLegends -> Automatic, ChartStyle -> 99]

Out[4]= [image]
```

---

Associations can be nested:

```wl
In[1]:= RectangleChart[<|"group a" -> <|"a" -> {1, 2}, "b" -> {2, 1}|>, "group b" -> <|"a" -> {1, 1}, "b" -> {2, 2}|>|>, ChartLegends -> Automatic]

Out[1]= [image]
```

---

The weights in ``WeightedData`` are ignored:

```wl
In[1]:= RectangleChart[WeightedData[{{1, 1}, {2, 1}, {3, 2}, {4, 3}, {5, 5}}, {0.5, 0.2, 0.1, 0.2, 0.3}]]

Out[1]= [image]
```

---

Use different layouts to display multiple datasets:

```wl
In[1]:= Table[RectangleChart[Tuples[{1, 2}, 2], ChartLayout -> l], {l, {"Grouped", "Stepped"}}]

Out[1]= {[image], [image]}
```

---

Use a row of sector charts:

```wl
In[1]:= RectangleChart[{IconizedObject[«data #1»], IconizedObject[«data #2»], IconizedObject[«data #3»]}, ImageSize -> Medium, ChartLayout -> "Row"]

Out[1]= [image]
```

Use a column of sector charts:

```wl
In[2]:= RectangleChart[{IconizedObject[«data #1»], IconizedObject[«data #2»], IconizedObject[«data #3»]}, ImageSize -> Medium, ChartLayout -> "Column"]

Out[2]= [image]
```

Multiple rows or columns:

```wl
In[3]:= RectangleChart[{IconizedObject[«data #1»], IconizedObject[«data #2»], IconizedObject[«data #3»], IconizedObject[«data #4»]}, ImageSize -> Medium, ChartLayout -> {"Row", 2}]

Out[3]= [image]
```

---

Control the origin of bars:

```wl
In[1]:= Table[RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, BarOrigin -> o, PlotLabel -> o], {o, {Bottom, Left, Top, Right}}]

Out[1]= {[image], [image], [image], [image]}
```

---

Adjust the spacing between bars and groups of bars:

```wl
In[1]:= Table[RectangleChart[Tuples[{1, 2}, 2], BarSpacing -> s, PlotLabel -> s, ChartStyle -> Opacity[0.8]], {s, {Automatic, {0, 1}, {-0.3, 1}}}]

Out[1]= {[image], [image], [image]}
```

#### Tabular Data (1)

Get tabular data:

```wl
In[1]:= tabdata = AggregateRows[Tabular[ResourceData["Sample Data: 1993 US Cars"]], {"AvgPrice" -> (Mean[#AvgPrice]&), "TotalCars" -> (Length[#AvgPrice]&), "AvgWeight" -> (Mean[#Weight]&), "AvgFuelTankCap" -> (Mean[#FuelTankCapacity]&)}, {"Type"}]

Out[1]=
Tabular[Association["RawSchema" -> Association["ColumnProperties" -> 
     Association["Type" -> Association["ElementType" -> "String"], 
      "AvgPrice" -> Association["ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]], 
      "To ...  {6, {{{12.619047619047619, 18.450000000000003, 
               16.06875, Rational[210, 11], 15.950000000000001, 20.944444444444443}, {}, None}}, 
            None}, "ElementType" -> TypeSpecifier["Quantity"]["NumberExpression", "Gallons"]]]}}]]]]
```

Compare the average price of each group of cars along the number of cars:

```wl
In[2]:= RectangleChart[tabdata -> {"TotalCars", "AvgPrice"}, ChartLabels -> Normal[tabdata[All, "Type"]]]

Out[2]= [image]
```

#### Wrappers (5)

Use wrappers on individual data, datasets, or collections of datasets:

```wl
In[1]:= {RectangleChart[{{{1, 1}, Style[{1, 2}, Red], {2, 3}}, {{1, 1}, {2, 1}}}], RectangleChart[{Style[{{1, 1}, {1, 2}, {2, 3}}, Green], {{1, 1}, {2, 1}}}], RectangleChart[Style[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, Blue]]}

Out[1]= {[image], [image], [image]}
```

---

Wrappers can be nested:

```wl
In[1]:= {RectangleChart[{{{1, 1}, Style[{1, 2}, Red], {2, 3}}, {{1, 1}, {2, 1}}}], RectangleChart[{Style[{{1, 1}, Style[{1, 2}, Red], {2, 3}}, Green], {{1, 1}, {2, 1}}}], RectangleChart[Style[{Style[{{1, 1}, Style[{1, 2}, Red], {2, 3}}, Green], {{1, 1}, {2, 1}}}, Blue]]}

Out[1]= {[image], [image], [image]}
```

---

Override the default tooltips:

```wl
In[1]:= RectangleChart[{{1, 1}, Tooltip[{1, 2}, "median"], {2, 3}}]

Out[1]= [image]
```

Use any object in the tooltip:

```wl
In[2]:= RectangleChart[Table[Tooltip[{CountryData[c, "Population"], CountryData[c, "GDPPerCapita"]}, CountryData[c, "Flag"]], {c, CountryData["G8"]}], BarSpacing -> 0]

Out[2]= [image]
```

---

Use ``PopupWindow`` to provide additional drilldown information:

```wl
In[1]:= RectangleChart[{{1, 1}, PopupWindow[{1, 2}, DateListPlot[FinancialData["IBM", "Jan. 1, 2004"]]], {2, 3}}]

Out[1]= [image]
```

---

``Button`` can be used to trigger any action:

```wl
In[1]:= RectangleChart[{{1, 1}, Button[{1, 2}, Speak[2]], {2, 3}}]

Out[1]= [image]
```

#### Styling and Appearance (9)

Use an explicit list of styles for the bars:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartStyle -> {Red, Green, Blue}]

Out[1]= [image]
```

---

Use any gradient or indexed color schemes from ``ColorData``:

```wl
In[1]:= {RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartStyle -> "Pastel"], RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartStyle -> 12]}

Out[1]= {[image], [image]}
```

---

Use color schemes designed for charting:

```wl
In[1]:= ColorData["Charting"]

Out[1]= {44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114}

In[2]:= Table[RectangleChart[Tuples[{1, 2, 3, 4}, 2], ChartStyle -> i, Axes -> None], {i, ColorData["Charting"][[1 ;; 4]]}]

Out[2]= {[image], [image], [image], [image]}
```

---

Alter the appearance of charts with built-in themes:

```wl
In[1]:= {RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, PlotTheme -> "Marketing"], RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, PlotTheme -> "Detailed"]}

Out[1]= {[image], [image]}
```

---

``ChartBaseStyle`` can be used to set an initial style for all chart elements:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartBaseStyle -> EdgeForm[Dashed], ChartStyle -> 45]

Out[1]= [image]
```

---

``Style`` can be used to override styles:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, Style[{3, 4}, Red], {2, 3}}, ChartStyle -> Gray]

Out[1]= [image]
```

---

Use any graphic for pictorial bars:

```wl
In[1]:= {RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartElements -> Graphics[Disk[]]], RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartElements -> ExampleData[{"TestImage", "House"}]]}

Out[1]= {[image], [image]}
```

---

Use built-in programmatically generated bars:

```wl
In[1]:= ChartElementData["RectangleChart"]

Out[1]= {"ArrowRectangle", "EdgeFadingRectangle", "FadingRectangle", "GlassRectangle", "GradientRectangle", "GradientScaleRectangle", "ObliqueRectangle", "Rectangle", "SegmentScaleRectangle"}

In[2]:= Table[RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartElementFunction -> f, ChartStyle -> "Pastel"], {f, {"FadingRectangle", "GlassRectangle"}}]

Out[2]= {[image], [image]}
```

For detailed settings use Palettes ▶ ChartElementSchemes :

```wl
In[3]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartElementFunction -> ChartElementDataFunction["SegmentScaleRectangle", "Segments" -> 7, "ColorScheme" -> "SolarColors"]]

Out[3]= [image]
```

---

Use a theme with detailed frame ticks and grid lines:

```wl
In[1]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{2, 1}, {1, 2}}}, PlotTheme -> "Detailed"]

Out[1]= [image]
```

Use a theme with a high-contrast color scheme and edge-fading rectangles:

```wl
In[2]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{2, 1}, {1, 2}}}, PlotTheme -> "Marketing"]

Out[2]= [image]
```

#### Labeling and Legending (13)

Use ``Labeled`` to add a label to a bar:

```wl
In[1]:= RectangleChart[{{1, 1}, Labeled[{1, 2}, "label"], {2, 3}}]

Out[1]= [image]
```

---

Use symbolic positions for label placement:

```wl
In[1]:= Table[RectangleChart[{{1, 1}, Labeled[{1, 2}, "label", p], {2, 3}}, PlotLabel -> p, Ticks -> None], {p, {Bottom, Center, Top}}]

Out[1]= {[image], [image], [image]}

In[2]:= Table[RectangleChart[{{1, 1}, Labeled[{1, 2}, "label", p], {2, 3}}, BarOrigin -> Left, PlotLabel -> p, Ticks -> None], {p, {Left, Center, Right}}]

Out[2]= {[image], [image], [image]}
```

---

Provide categorical labels for the columns of data:

```wl
In[1]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, ChartLabels -> {"c1", "c2", "c3"}]

Out[1]= [image]
```

For rows of data:

```wl
In[2]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, ChartLabels -> {{"r1", "r2"}, None}]

Out[2]= [image]
```

For both:

```wl
In[3]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, ChartLabels -> {{"r1", "r2"}, {"c1", "c2", "c3"}}]

Out[3]= [image]
```

---

Use ``Placed`` to control the positioning of labels, using the same positions as for ``Labeled``:

```wl
In[1]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, ChartLabels -> {Placed[{"r1", "r2"}, Above], Placed[{"c1", "c2", "c3"}, Center]}]

Out[1]= [image]
```

---

Use ``Callout`` to add a label to a bar:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, Callout[{2, 3}, "label"]}]

Out[1]= [image]
```

---

Change the appearance of the callout:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, Callout[{2, 3}, "label", Appearance -> "Balloon"]}]

Out[1]= [image]
```

---

Automatically position callouts:

```wl
In[1]:= RectangleChart[Table[Callout[RandomReal[{1, 5}, 2], Unique["text"]], 5]]

Out[1]= [image]
```

---

Provide value labels for bars by using ``LabelingFunction`` :

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, LabelingFunction -> Above]

Out[1]= [image]
```

---

Use ``Placed`` to control placement and formatting:

```wl
In[1]:= labeler[v_, {i_, j_}, {ri_, cj_}] := Placed[Column[{v, ri[[1]], cj[[1]]}, ","], Center]

In[2]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, ChartLabels -> {{"r1", "r2"}, {"c1", "c2", "c3"}}, LabelingFunction -> labeler]

Out[2]= [image]
```

---

Generate callouts from the data:

```wl
In[1]:= RectangleChart[{{1, 4}, {5, 5}, {1, 1}, {4, 1}, {2, 3}}, LabelingFunction -> (Callout[Style[Times@@#, 10 + 5Max[#]], Above]&)]

Out[1]= [image]
```

---

Add categorical legend entries for the columns of data:

```wl
In[1]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, ChartLegends -> {"ccc1", "ccc2", "ccc3"}, ChartStyle -> "Pastel"]

Out[1]= [image]
```

For rows of data:

```wl
In[2]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, ChartLegends -> {{"rr1", "rr2"}, None}, ChartStyle -> {"Pastel", None}]

Out[2]= [image]
```

---

Use ``Legended`` to add additional legend entries:

```wl
In[1]:= RectangleChart[{{{1, 1}, Legended[{1, 2}, "extra"], {2, 3}}, {{1, 1}, {2, 1}}}, ChartStyle -> "Pastel", ChartLegends -> {"aaa", "bbb", "ccc"}]

Out[1]= [image]
```

---

Use ``Placed`` to affect the positioning of legends:

```wl
In[1]:= Table[RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, ChartLegends -> Placed[{"ccc1", "ccc2", "ccc3"}, p], ChartStyle -> "Pastel"], {p, {Before, Below}}]

Out[1]= [image]
```

### Options (93)

#### AspectRatio (4)

By default, ``RectangleChart`` uses a fixed height-to-width ratio for the plot:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 1}, {1, 4}, {2, 2}}]

Out[1]= [image]
```

---

Make the height the same as the width with ``AspectRatio -> 1`` :

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 1}, {1, 4}, {2, 2}}, AspectRatio -> 1]

Out[1]= [image]
```

---

``AspectRatio -> Automatic`` determines the ratio from the data:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 1}, {1, 4}, {2, 2}}, AspectRatio -> Automatic]

Out[1]= [image]
```

---

``AspectRatio -> Full`` adjusts the height and width to fit tightly inside other constructs:

```wl
In[1]:= plot = RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 1}, {1, 4}, {2, 2}}, AspectRatio -> Full];

In[2]:= {Framed[Pane[plot, {50, 100}]], Framed[Pane[plot, {100, 100}]], Framed[Pane[plot, {100, 50}]]}

Out[2]= {[image], [image], [image]}
```

#### Axes (3)

By default, axes are drawn:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 1}, {1, 4}, {2, 2}}]

Out[1]= [image]
```

---

Use ``Axes -> False`` to turn off axes:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 1}, {1, 4}, {2, 2}}, Axes -> False]

Out[1]= [image]
```

---

Turn each axis on individually:

```wl
In[1]:= {RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 1}, {1, 4}, {2, 2}}, Axes -> {False, True}], RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 1}, {1, 4}, {2, 2}}, Axes -> {True, False}]}

Out[1]= {[image], [image]}
```

#### AxesStyle (4)

Change the style for the axes:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 1}, {1, 4}, {2, 2}}, AxesStyle -> Red]

Out[1]= [image]
```

---

Specify the style of each axis:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 1}, {1, 4}, {2, 2}}, AxesStyle -> {Red, Blue}]

Out[1]= [image]
```

---

Use different styles for the ticks and the axes:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 1}, {1, 4}, {2, 2}}, AxesStyle -> Green, TicksStyle -> Black]

Out[1]= [image]
```

---

Use different styles for the labels and the axes:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 1}, {1, 4}, {2, 2}}, AxesStyle -> Green, LabelStyle -> Black]

Out[1]= [image]
```

#### BarOrigin (1)

Change the bar origin:

```wl
In[1]:= Table[RectangleChart[Tuples[{1, 2}, 2], BarOrigin -> o, PlotLabel -> o], {o, {Top, Bottom, Left, Right}}]

Out[1]= {[image], [image], [image], [image]}
```

#### BarSpacing (5)

Use automatically determined spacing between bars:

```wl
In[1]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, BarSpacing -> Automatic]

Out[1]= [image]
```

---

Use no spacing:

```wl
In[1]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, BarSpacing -> None]

Out[1]= [image]
```

---

Use symbolic presets:

```wl
In[1]:= Table[RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, BarSpacing -> s, PlotLabel -> s], {s, {Tiny, Small, Medium, Large}}]

Out[1]= {[image], [image], [image], [image]}
```

---

Use explicit spacing between bars:

```wl
In[1]:= Table[RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, BarSpacing -> s, ChartStyle -> Opacity[0.8], PlotLabel -> s], {s, {Automatic, 1, -0.3}}]

Out[1]= {[image], [image], [image]}
```

---

Use explicit spacing between bars and groups of bars:

```wl
In[1]:= Table[RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, BarSpacing -> s, PlotLabel -> s], {s, {Automatic, {0, 1}, {0, 0.2}}}]

Out[1]= {[image], [image], [image]}
```

#### ChartBaseStyle (5)

Use ``ChartBaseStyle`` to style all bars:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartBaseStyle -> EdgeForm[Dashed]]

Out[1]= [image]

In[2]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, ChartBaseStyle -> EdgeForm[Dashed]]

Out[2]= [image]

In[3]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, BarSpacing -> -0.3, ChartBaseStyle -> Opacity[0.7]]

Out[3]= [image]
```

---

``ChartBaseStyle`` combines with ``ChartStyle``:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartStyle -> 24, ChartBaseStyle -> EdgeForm[Dashed]]

Out[1]= [image]
```

---

``ChartStyle`` may override settings for ``ChartBaseStyle``:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartStyle -> EdgeForm[None], ChartBaseStyle -> EdgeForm[Dashed]]

Out[1]= [image]
```

---

``ChartBaseStyle`` combines with ``Style`` :

```wl
In[1]:= RectangleChart[{{1, 1}, Style[{1, 2}, Yellow], {2, 3}}, ChartBaseStyle -> EdgeForm[Dashed]]

Out[1]= [image]
```

``Style`` may override settings for ``ChartBaseStyle`` :

```wl
In[2]:= RectangleChart[{{1, 1}, Style[{1, 2}, EdgeForm[None]], {2, 3}}, ChartBaseStyle -> EdgeForm[Dashed]]

Out[2]= [image]
```

---

``ChartBaseStyle`` combines with ``ColorFunction`` :

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartBaseStyle -> EdgeForm[Dashed], ColorFunction -> Function[{x, y}, ColorData["Pastel"][x * y]]]

Out[1]= [image]
```

``ColorFunction`` may override settings for ``ChartBaseStyle`` :

```wl
In[2]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartBaseStyle -> EdgeForm[Dashed], ColorFunction -> (EdgeForm[None]&)]

Out[2]= [image]
```

#### ChartElementFunction (5)

Get a list of built-in settings for ``ChartElementFunction``:

```wl
In[1]:= ChartElementData["RectangleChart"]

Out[1]= {"ArrowRectangle", "EdgeFadingRectangle", "FadingRectangle", "GlassRectangle", "GradientRectangle", "GradientScaleRectangle", "ObliqueRectangle", "Rectangle", "SegmentScaleRectangle"}
```

---

For detailed settings use Palettes ▶ ChartElementSchemes :

```wl
In[1]:= Table[RectangleChart[Tuples[{1, 2}, 2], ChartElementFunction -> f, ChartStyle -> "Pastel", PlotLabel -> f], {f, {"Rectangle", "ObliqueRectangle"}}]

Out[1]= {[image], [image]}

In[2]:= Table[RectangleChart[Tuples[{1, 2}, 2], ChartElementFunction -> f, ChartStyle -> "Pastel", PlotLabel -> f], {f, {"FadingRectangle", "GlassRectangle"}}]

Out[2]= {[image], [image]}
```

---

Here is a ``ChartElementFunction`` appropriate to show the global scale:

```wl
In[1]:= Table[RectangleChart[Tuples[{1, 2}, 2], ChartElementFunction -> f, ChartStyle -> "Pastel", PlotLabel -> f], {f, {"GradientScaleRectangle", "SegmentScaleRectangle"}}]

Out[1]= {[image], [image]}
```

---

Write a custom ``ChartElementFunction``:

```wl
In[1]:= f[{{xmin_, xmax_}, {ymin_, ymax_}}, ___] := Rectangle[{xmin, ymin}, {xmax, ymax}]

In[2]:= RectangleChart[Tuples[{1, 2}, 2], ChartElementFunction -> f]

Out[2]= [image]

In[3]:= g[{{xmin_, xmax_}, {ymin_, ymax_}}, ___] := Polygon[{{xmin, ymin}, {xmax, ymax}, {xmin, ymax}, {xmax, ymin}}]

In[4]:= RectangleChart[Tuples[{1, 2}, 2], ChartElementFunction -> g]

Out[4]= [image]
```

---

Use metadata passed on from the input, in this case charting the data:

```wl
In[1]:=
DataDrilldownBar[{{xmin_, xmax_}, {ymin_, ymax_}}, y_, {data_List}] := 
	PopupWindow[Polygon[{{xmin, ymin}, {xmax, ymax}, {xmin, ymax}, {xmax, ymin}}], PieChart[data]]

In[2]:=
DataDrilldownBar[{{xmin_, xmax_}, {ymin_, ymax_}}, y_, _] := 
	Rectangle[{xmin, ymin}, {xmax, ymax}]

In[3]:= RectangleChart[{{1, 1} -> Range[5], {1, 2}, {2, 1} -> RandomReal[1, 10]}, ChartElementFunction -> DataDrilldownBar]

Out[3]= [image]
```

#### ChartElements (9)

Create a pictorial chart based on any ``Graphics`` object:

```wl
In[1]:= RectangleChart[Tuples[{1, 2}, 2], ChartElements -> Graphics[Disk[]]]

Out[1]= [image]
```

``Graphics3D`` :

```wl
In[2]:= RectangleChart[Tuples[{1, 2}, 2], ChartElements -> Graphics3D[Sphere[]]]

Out[2]= [image]
```

``Image``:

```wl
In[3]:= RectangleChart[Tuples[{1, 2}, 2], ChartElements -> ExampleData[{"TestImage", "House"}]]

Out[3]= [image]
```

---

Use a stretched version of the graphic:

```wl
In[1]:= RectangleChart[Tuples[{1, 2}, 2], ChartElements -> {[image], All}]

Out[1]= [image]
```

---

Use explicit sizes for width and height:

```wl
In[1]:= Table[RectangleChart[Tuples[{1, 2}, 2], ChartElements -> {Graphics[Disk[], AspectRatio -> Full], s}, PlotLabel -> s], {s, {{1 / 2, 1}, {1, 1 / 2}}}]

Out[1]= {[image], [image]}
```

Without ``AspectRatio -> Full``, the original aspect ratio is preserved:

```wl
In[2]:= Table[RectangleChart[Tuples[{1, 2}, 2], ChartElements -> {Graphics[Disk[]], s}, PlotLabel -> s], {s, {{1 / 2, 1}, {1, 1 / 2}}}]

Out[2]= {[image], [image]}
```

---

Using ``All`` for width or height causes that direction to stretch to the full size of the bar:

```wl
In[1]:= Table[RectangleChart[Tuples[{1, 2}, 2], ChartElements -> {[image], s}, PlotLabel -> s], {s, {{1 / 2, All}, {All, 1 / 2}}}]

Out[1]= {[image], [image]}
```

---

Use a different graphic for each column of data:

```wl
In[1]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, ChartElements -> {[image], [image], [image]}]

Out[1]= [image]
```

Use a different graphic for each row of data:

```wl
In[2]:= RectangleChart[{{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}}, ChartElements -> {{[image], [image]}, None}]

Out[2]= [image]
```

---

Graphics are used cyclically:

```wl
In[1]:= RectangleChart[Tuples[{1, 2}, 2], ChartElements -> {{[image], All}, {[image], All}}]

Out[1]= [image]
```

---

Styles are inherited from styles set through ``ChartStyle`` etc:

```wl
In[1]:= RectangleChart[Tuples[{1, 2}, 2], ChartElements -> [image], ChartStyle -> "Pastel"]

Out[1]= [image]
```

Explicit styles set in the graphic will override other style settings:

```wl
In[2]:= RectangleChart[Tuples[{1, 2}, 2], ChartElements -> [image], ChartStyle -> "Pastel"]

Out[2]= [image]
```

---

The orientation of the pictorial graphic is unaffected by ``BarOrigin``:

```wl
In[1]:= Table[RectangleChart[Tuples[{1, 2}, 2], ChartElements -> [image], BarOrigin -> o], {o, {Bottom, Top, Left, Right}}]

Out[1]= {[image], [image], [image], [image]}
```

---

Create true 3D shaded bars:

```wl
In[1]:= g = Graphics3D[{EdgeForm[], Specularity[White, 30], Cylinder[]}, ViewPoint -> {0, -Infinity, 0}, Boxed -> False, Lighting -> "Neutral", PlotRangePadding -> 0];

In[2]:= RectangleChart[Tuples[{1, 2}, 2], ChartElements -> {g, All}]

Out[2]= [image]
```

#### ChartLabels (8)

By default, labels are placed in the axis:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartLabels -> {"a", "b", "c"}]

Out[1]= [image]
```

``Labeled`` wrappers in data will place additional labels:

```wl
In[2]:= RectangleChart[{{1, 1}, Labeled[{1, 2}, "label", Center], {2, 3}}, ChartLabels -> {"a", "b", "c"}]

Out[2]= [image]
```

---

Use ``Placed`` to control label placement:

```wl
In[1]:= Table[RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartLabels -> Placed[{"a", "b", "c"}, p], PlotLabel -> p, Ticks -> None], {p, {Bottom, Center, Top}}]

Out[1]= {[image], [image], [image]}
```

Positions outside the bar:

```wl
In[2]:= Table[RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartLabels -> Placed[{"a", "b", "c"}, p], PlotLabel -> p, Ticks -> None], {p, {Below, Above}}]

Out[2]= {[image], [image]}

In[3]:= Table[RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartLabels -> Placed[{"a", "b", "c"}, p], BarOrigin -> Left, PlotLabel -> p, Ticks -> None], {p, {Before, After}}]

Out[3]= {[image], [image]}
```

---

Coordinate-based placement relative to a bar:

```wl
In[1]:= Table[RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartLabels -> Placed[{"aa", "bb", "cc"}, p], BarSpacing -> 0.5, Ticks -> None, PlotLabel -> p], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

Out[1]= {[image], [image], [image]}
```

---

Place all labels at the upper-right corner and vary the coordinates within the label:

```wl
In[1]:= Table[RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartLabels -> Placed[Framed /@ {"aa", "bb", "cc"}, {{1, 1}, p}], BarSpacing -> 0.8, Ticks -> None, PlotLabel -> p], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

Out[1]= {[image], [image], [image]}
```

---

Use the third argument to ``Placed`` to control formatting:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartLabels -> Placed[{"aaa", "bbb", "ccc"}, Center, Rotate[#, 45Degree]&]]

Out[1]= [image]

In[2]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartLabels -> Placed[{"aaa", "bbb", "ccc"}, Center, Panel[#, FrameMargins -> 0]&]]

Out[2]= [image]
```

Use a hyperlink label:

```wl
In[3]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartLabels -> Placed[{"aaa", "bbb", "ccc"}, Center, Hyperlink[#, "http://www.wolfram.com"]&]]

Out[3]= [image]
```

Rotate the labels:

```wl
In[4]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartLabels -> Placed[{"aaa", "bbb", "ccc"}, Axis, Rotate[#, Pi / 4]&]]

Out[4]= [image]
```

---

By default, labels are associated with columns of data:

```wl
In[1]:= data = {{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}};

In[2]:=
{RectangleChart[data, ChartLabels -> {"c1", "c2", "c3"}], 
	RectangleChart[data, ChartLabels -> {None, {"c1", "c2", "c3"}}]}

Out[2]= {[image], [image]}
```

Associate labels with rows or datasets:

```wl
In[3]:= RectangleChart[data, ChartLabels -> {{"r1", "r2"}, None}]

Out[3]= [image]
```

Label both rows and columns:

```wl
In[4]:= RectangleChart[data, ChartLabels -> {{"r1", "r2"}, {"c1", "c2", "c3"}}]

Out[4]= [image]
```

Use ``Placed`` to affect placements:

```wl
In[5]:= RectangleChart[data, ChartLabels -> {Placed[{"r1", "r2"}, Below], Placed[{"c1", "c2", "c3"}, Center]}]

Out[5]= [image]
```

---

Use ``Callout`` to connect the labels to the bars:

```wl
In[1]:= RectangleChart[{{1, 5}, {8, 4}, {6, 7}}, ChartLabels -> Callout[{"c1", "c2", "c3"}, Automatic]]

Out[1]= [image]
```

---

Place multiple labels:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartLabels -> Placed[{{"a", "b", "c"}, {"x", "y", "z"}}, {Top, Bottom}]]

Out[1]= [image]
```

#### ChartLayout (3)

``ChartLayout`` is grouped by default:

```wl
In[1]:= data = {{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}};

In[2]:= RectangleChart[data]

Out[2]= [image]
```

Use stepped bars:

```wl
In[3]:= RectangleChart[data, ChartLayout -> "Stepped"]

Out[3]= [image]
```

---

Place each of the sectors in a separate panel using shared scales:

```wl
In[1]:= RectangleChart[{{{1, 6}, {1, 4}, {2, 7}, {1, 6}, {2, 8}}, {{1, 4}, {2, 3}, {2, 10}, {1, 6}, {2, 4}}, {{1, 8}, {1, 3}, {2, 8}, {2, 7}, {2, 6}}}, ImageSize -> Medium, ChartLayout -> Column]

Out[1]= [image]
```

Use a row instead of a column:

```wl
In[2]:= RectangleChart[{{{1, 6}, {1, 4}, {2, 7}, {1, 6}, {2, 8}}, {{1, 4}, {2, 3}, {2, 10}, {1, 6}, {2, 4}}, {{1, 8}, {1, 3}, {2, 8}, {2, 7}, {2, 6}}}, ImageSize -> Medium, ChartLayout -> "Row"]

Out[2]= [image]
```

---

Use multiple columns or rows:

```wl
In[1]:= RectangleChart[{IconizedObject[«data #1»], IconizedObject[«data #2»], IconizedObject[«data #3»], IconizedObject[«data #4»], IconizedObject[«data #5»], IconizedObject[«data #6»]}, ImageSize -> Medium, ChartLayout -> {"Column", 4}]

Out[1]= [image]
```

Prefer full columns or rows:

```wl
In[2]:= RectangleChart[{IconizedObject[«data #1»], IconizedObject[«data #2»], IconizedObject[«data #3»], IconizedObject[«data #4»], IconizedObject[«data #5»], IconizedObject[«data #6»]}, ImageSize -> Medium, ChartLayout -> {"Column", UpTo[4]}]

Out[2]= [image]
```

#### ChartLegends (4)

Generate a legend based on chart style:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, ChartStyle -> "Pastel", ChartLegends -> {"John", "Mary", "Bob"}]

Out[1]= [image]
```

---

Use ``Legended`` to add additional legend entries:

```wl
In[1]:= RectangleChart[{{1, 1}, Legended[{1, 2}, "Henry"], {2, 3}}, ChartStyle -> "Pastel", ChartLegends -> {"John", "Mary", "Bob"}]

Out[1]= [image]
```

Or to specify individual legend entries:

```wl
In[2]:= RectangleChart[{{1, 1}, Legended[{1, 2}, "Henry"], {2, 3}}, ChartStyle -> "Pastel"]

Out[2]= [image]
```

---

Generate a legend for datasets:

```wl
In[1]:= data = {{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}};

In[2]:= RectangleChart[data, ChartLegends -> {{"Group A", "Group B"}, None}, ChartStyle -> {"Pastel", None}]

Out[2]= [image]
```

Unused legend labels are dropped:

```wl
In[3]:= RectangleChart[data, ChartLegends -> {{"Group A", "Group B", "Group C"}, None}, ChartStyle -> {"Pastel", None}]

Out[3]= [image]
```

Legends can be applied to several dimensions:

```wl
In[4]:= RectangleChart[data, ChartLegends -> {{"Test A", "Test B"}, {"John", "Mary", "Bob"}}, ChartStyle -> {{EdgeForm[Thick], EdgeForm[Dashed]}, "Pastel"}]

Out[4]= [image]
```

---

Use ``Placed`` to control the placement of legends:

```wl
In[1]:= data = {{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}};

In[2]:= Table[RectangleChart[data, ChartLegends -> Placed[{"John", "Mary", "Bob"}, pos], ChartStyle -> "Pastel"], {pos, {Before, Below}}]

Out[2]= {[image], [image]}
```

#### ChartStyle (7)

Use ``ChartStyle`` to style bars:

```wl
In[1]:= Table[RectangleChart[Tuples[{1, 2}, 2], ChartStyle -> s], {s, {Green, EdgeForm[Dashed], Directive[Green, EdgeForm[Dashed]]}}]

Out[1]= {[image], [image], [image]}
```

---

Give a list of styles:

```wl
In[1]:= RectangleChart[Tuples[{1, 2}, 2], ChartStyle -> {Red, Green, Blue, Yellow}]

Out[1]= [image]
```

Use gradient colors from ``ColorData`` :

```wl
In[2]:= RectangleChart[Tuples[{1, 2}, 2], ChartStyle -> "Pastel"]

Out[2]= [image]
```

Use indexed colors from ``ColorData``:

```wl
In[3]:= RectangleChart[Tuples[{1, 2}, 2], ChartStyle -> 24]

Out[3]= [image]
```

---

Styles are used cyclically:

```wl
In[1]:= RectangleChart[Tuples[{1, 2}, 2], ChartStyle -> {Red, Green}]

Out[1]= [image]
```

---

Style each column of data:

```wl
In[1]:= data = {{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}};

In[2]:= RectangleChart[data, ChartStyle -> {Red, Green, Blue}]

Out[2]= [image]
```

Style each row of data:

```wl
In[3]:= RectangleChart[data, ChartStyle -> {{Red, Green}, None}]

Out[3]= [image]
```

Style both rows and columns of data:

```wl
In[4]:= RectangleChart[data, ChartStyle -> {{EdgeForm[Dotted], EdgeForm[Dashed]}, {Red, Green, Blue}}]

Out[4]= [image]
```

With both row and column styles, the last style may override earlier ones:

```wl
In[5]:= RectangleChart[data, ChartStyle -> {{Yellow, Magenta}, {Red, Green, Blue}}]

Out[5]= [image]
```

---

``Style`` overrides settings for ``ChartStyle``:

```wl
In[1]:= RectangleChart[{{1, 1}, Style[{1, 3}, Yellow], {3, 2}}, ChartStyle -> {Red, Green, Blue}]

Out[1]= [image]

In[2]:= RectangleChart[{{1, 1}, Style[{1, 3}, EdgeForm[Dashed]], {3, 2}}, ChartStyle -> {Red, Green, Blue}]

Out[2]= [image]
```

---

``ColorFunction`` overrides settings for ``ChartStyle``:

```wl
In[1]:= RectangleChart[Tuples[{1, 2}, 2], ChartStyle -> {Red, Green, Blue, Brown}, ColorFunction -> "SolarColors"]

Out[1]= [image]

In[2]:= RectangleChart[Tuples[{1, 2}, 2], ChartStyle -> EdgeForm /@ {Dashed, Dotted, DotDashed}, ColorFunction -> (Blend[{LightBlue, LightRed}, #]&)]

Out[2]= [image]
```

---

``ChartElements`` with explicit style settings override settings for ``ChartStyle``:

```wl
In[1]:= RectangleChart[Tuples[{1, 2}, 2], ChartElements -> [image], ChartStyle -> "Pastel"]

Out[1]= [image]
```

#### ColorFunction (4)

Color by bar height:

```wl
In[1]:= RectangleChart[Table[{Exp[-t ^ 2], Exp[-t ^ 2]}, {t, -2, 2, 0.25}], ColorFunction -> Function[{width, height}, ColorData["Rainbow"][height]]]

Out[1]= [image]
```

---

Use ``ColorFunctionScaling -> False`` to get unscaled height values:

```wl
In[1]:= RectangleChart[Tuples[{1, 2}, 2], ColorFunction -> (Switch[{#1, #2}, {1, 1}, Yellow, {1, 2}, Orange, {2, 1}, Red, _, Blue]&), ColorFunctionScaling -> False]

Out[1]= [image]
```

Color by area:

```wl
In[2]:= RectangleChart[{{1, 1}, {1, 2}, {2, 1}, {2, 2}}, ColorFunction -> Function[{width, height}, ColorData["Rainbow"][width height / 4]], ColorFunctionScaling -> False]

Out[2]= [image]
```

---

``ColorFunction`` overrides styles in ``ChartStyle``:

```wl
In[1]:= RectangleChart[Tuples[{1, 2, 3}, 2], ChartStyle -> {Red, Green, Brown}, ColorFunction -> "Pastel"]

Out[1]= [image]
```

---

Use ``ColorFunction`` to combine different style effects:

```wl
In[1]:= RectangleChart[Table[{Exp[-t ^ 2], Exp[-t ^ 2]}, {t, -2, 2, 0.25}], ColorFunction -> Function[{width, height}, Opacity[height]], ChartStyle -> Purple]

Out[1]= [image]
```

#### ColorFunctionScaling (2)

Use ``ColorFunctionScaling -> False`` to get unscaled height values:

```wl
In[1]:= RectangleChart[Tuples[{1, 2}, 2], ColorFunction -> (Switch[{#1, #2}, {1, 1}, Yellow, {1, 2}, Orange, {2, 1}, Red, _, Blue]&), ColorFunctionScaling -> False]

Out[1]= [image]
```

---

Color by area:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 1}, {2, 2}}, ColorFunction -> Function[{width, height}, ColorData["Rainbow"][width height / 4]], ColorFunctionScaling -> False]

Out[1]= [image]
```

#### ImageSize (7)

Use named sizes, such as ``Tiny``, ``Small``, ``Medium`` and ``Large`` :

```wl
In[1]:= {RectangleChart[IconizedObject[«data»], ImageSize -> Tiny], RectangleChart[IconizedObject[«data»], ImageSize -> Small]}

Out[1]= {[image], [image]}
```

---

Specify the width of the plot:

```wl
In[1]:= {RectangleChart[IconizedObject[«data»], ImageSize -> 150], RectangleChart[IconizedObject[«data»], AspectRatio -> 1.5, ImageSize -> 150]}

Out[1]= {[image], [image]}
```

Specify the height of the plot:

```wl
In[2]:= {RectangleChart[IconizedObject[«data»], ImageSize -> {Automatic, 150}], RectangleChart[IconizedObject[«data»], AspectRatio -> 2, ImageSize -> {Automatic, 150}]}

Out[2]= {[image], [image]}
```

---

Allow the width and height to be up to a certain size:

```wl
In[1]:= {RectangleChart[IconizedObject[«data»], ImageSize -> UpTo[200]], RectangleChart[IconizedObject[«data»], AspectRatio -> 2, ImageSize -> UpTo[200]]}

Out[1]= {[image], [image]}
```

---

Specify the width and height for a graphic, padding with space if necessary:

```wl
In[1]:= RectangleChart[IconizedObject[«data»], ImageSize -> {200, 200}, Background -> LightBlue]

Out[1]= [image]
```

Setting ``AspectRatio -> Full`` will fill the available space:

```wl
In[2]:= RectangleChart[IconizedObject[«data»], AspectRatio -> Full, ImageSize -> {200, 200}, Background -> LightBlue]

Out[2]= [image]
```

---

Use maximum sizes for the width and height:

```wl
In[1]:= {RectangleChart[IconizedObject[«data»], ImageSize -> {UpTo[150], UpTo[100]}], RectangleChart[IconizedObject[«data»], AspectRatio -> 2, ImageSize -> {UpTo[150], UpTo[100]}]}

Out[1]= {[image], [image]}
```

---

Use ``ImageSize -> Full`` to fill the available space in an object:

```wl
In[1]:= Framed[Pane[RectangleChart[IconizedObject[«data»], ImageSize -> Full, Background -> LightBlue], {200, 100}]]

Out[1]= [image]
```

---

Specify the image size as a fraction of the available space:

```wl
In[1]:= Framed[Pane[RectangleChart[IconizedObject[«data»], AspectRatio -> Full, ImageSize -> {Scaled[0.5], Scaled[0.5]}, Background -> LightBlue], {200, 100}]]

Out[1]= [image]
```

#### LabelingFunction (8)

Use automatic labeling by values through ``Tooltip`` and ``StatusArea``:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, LabelingFunction -> Automatic]

Out[1]= [image]
```

---

Do no labeling:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, LabelingFunction -> None]

Out[1]= [image]
```

---

Use ``Placed`` to control label placement:

```wl
In[1]:= Table[RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, LabelingFunction -> (Placed[#, p]&), PlotLabel -> p, Ticks -> None], {p, {Bottom, Center, Top}}]

Out[1]= {[image], [image], [image]}
```

---

Symbolic positions outside the bar:

```wl
In[1]:= Table[RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, LabelingFunction -> (Placed[#, p]&), PlotLabel -> p, Ticks -> None], {p, {Below, Above}}]

Out[1]= {[image], [image]}

In[2]:= Table[RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, LabelingFunction -> (Placed[#, p]&), BarOrigin -> Left, PlotLabel -> p, Ticks -> None], {p, {Before, After}}]

Out[2]= {[image], [image]}
```

---

Coordinate-based placement relative to a bar:

```wl
In[1]:= Table[RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, LabelingFunction -> (Placed[#, p]&), BarSpacing -> 0.5, Ticks -> None, PlotLabel -> p], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

Out[1]= {[image], [image], [image]}
```

---

Use ``Callout`` to place labels automatically:

```wl
In[1]:= RectangleChart[{{3, 5}, {8, 4}, {6, 7}}, LabelingFunction -> (Callout[Row[#, "⊗"], Automatic]&)]

Out[1]= [image]
```

Use symbolic positions to place ``Callout`` labels:

```wl
In[2]:= Table[RectangleChart[{{3, 5}, {8, 4}, {6, 7}}, LabelingFunction -> (Callout[#, p]&)], {p, {Above, Below}}]

Out[2]= {[image], [image]}
```

---

Control the formatting of labels:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}}, LabelingFunction -> (Placed[Row[#, "to"], Above]&)]

Out[1]= [image]
```

---

Use the given chart labels as arguments to the labeling function:

```wl
In[1]:= data = {{{1, 1}, {1, 2}, {2, 3}}, {{1, 1}, {2, 1}}};

In[2]:= RectangleChart[data, ChartLabels -> {{"r1", "r2"}, {"c1", "c2", "c3"}}, LabelingFunction -> (Placed[Column[{#3[[1, 1]], #3[[2, 1]], #1}, ","], Center]&), ImageSize -> Medium]

Out[2]= [image]
```

Place complete labels as tooltips:

```wl
In[3]:= RectangleChart[data, ChartLabels -> {{"r1", "r2"}, {"c1", "c2", "c3"}}, LabelingFunction -> (Placed[Row[{#3[[1, 1]], #3[[2, 1]], #1}, ","], Tooltip]&)]

Out[3]= [image]
```

#### LabelingSize (4)

Textual labels are shown at their actual sizes:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 2}}, ChartLabels -> {"healthfulness", "obstreperous", "spectrogram", "pandemonium"}]

Out[1]= [image]
```

---

Image labels are automatically resized:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 2}}, ChartLabels -> {[image], [image], [image], [image]}]

Out[1]= [image]
```

---

Specify a maximum size for textual labels:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 2}}, ChartLabels -> {"healthfulness", "obstreperous", "spectrogram", "pandemonium"}, LabelingSize -> 50]

Out[1]= [image]
```

Specify a maximum size for image labels:

```wl
In[2]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 2}}, ChartLabels -> {[image], [image], [image], [image]}, LabelingSize -> 25]

Out[2]= [image]
```

---

Show image labels at their natural sizes:

```wl
In[1]:= RectangleChart[{{1, 1}, {1, 2}, {2, 3}, {3, 2}}, ChartLabels -> Placed[{[image], [image], [image], [image]}, Above], LabelingSize -> Full, ImageSize -> Medium]

Out[1]= [image]
```

#### PerformanceGoal (3)

Generate a bar chart with interactive highlighting:

```wl
In[1]:= RectangleChart[Tuples[{1, 2, 3}, 2], PerformanceGoal -> "Quality"]

Out[1]= [image]
```

---

Emphasize performance by disabling interactive behaviors:

```wl
In[1]:= RectangleChart[Tuples[{1, 2, 3}, 2], PerformanceGoal -> "Speed"]

Out[1]= [image]
```

---

Typically, less memory is required for non-interactive charts:

```wl
In[1]:= Table[ByteCount@RectangleChart[Tuples[{1, 2, 3}, 2], PerformanceGoal -> p], {p, {"Quality", "Speed"}}]

Out[1]= {30576, 20640}
```

#### PlotInteractivity (4)

Charts with a moderate number of bars automatically have tooltips and mouseover effects:

```wl
In[1]:= RectangleChart[{{1, 1}, {2, 2}, {2, 1}}]

Out[1]= [image]
```

---

Turn off all the interactive elements:

```wl
In[1]:= RectangleChart[{{1, 1}, {2, 2}, {2, 1}}, PlotInteractivity -> False]

Out[1]= [image]
```

---

Interactive elements provided as part of the input are disabled:

```wl
In[1]:= RectangleChart[{{1, 1}, {2, 2}, Tooltip[{2, 1}, "Hello"]}, PlotInteractivity -> False]

Out[1]= [image]
```

---

Allow provided interactive elements and disable automatic ones:

```wl
In[1]:= RectangleChart[{{1, 1}, {2, 2}, Tooltip[{2, 1}, "Hello"]}, PlotInteractivity -> <|"User" -> True, "System" -> False|>]

Out[1]= [image]
```

#### PlotTheme (1)

Use a theme with detailed frame ticks and grid lines:

```wl
In[1]:= RectangleChart[{{5, 1}, {3, 3}, {2, 4}}, PlotTheme -> "Detailed"]

Out[1]= [image]
```

Turn off the grid lines:

```wl
In[2]:= RectangleChart[{{5, 1}, {3, 3}, {2, 4}}, PlotTheme -> "Detailed", GridLines -> None]

Out[2]= [image]
```

#### TargetUnits (2)

Units are automatically detected:

```wl
In[1]:= RectangleChart[{{Quantity[3, "Seconds"], Quantity[2, "Meters"]}, {Quantity[8, "Seconds"], Quantity[5, "Meters"]}, {Quantity[2, "Seconds"], Quantity[3, "Meters"]}, {Quantity[1, "Seconds"], Quantity[3, "Meters"]}, {Quantity[8, "Seconds"], Quantity[7, "Meters"]}, {Quantity[7, "Seconds"], Quantity[1, "Meters"]}}, AxesLabel -> Automatic, BarSpacing -> None, Ticks -> True]

Out[1]= [image]
```

---

Specify the units to show in each direction:

```wl
In[1]:= RectangleChart[{{Quantity[3, "Seconds"], Quantity[2, "Meters"]}, {Quantity[8, "Seconds"], Quantity[5, "Meters"]}, {Quantity[2, "Seconds"], Quantity[3, "Meters"]}, {Quantity[1, "Seconds"], Quantity[3, "Meters"]}, {Quantity[8, "Seconds"], Quantity[7, "Meters"]}, {Quantity[7, "Seconds"], Quantity[1, "Meters"]}}, AxesLabel -> Automatic, BarSpacing -> None, Ticks -> True, TargetUnits -> {"Minutes", "Feet"}]

Out[1]= [image]
```

### Applications (12)

Move the slider to see how the left Riemann sum of $\sin (x)$ in ``[0, π]`` approaches $\int_0^{\pi } \sin (x) \, dx=2$ :

```wl
In[1]:= Manipulate[Show[RectangleChart[{Pi / n, #}& /@ Sin[Range[0, Pi - Pi / n, Pi / n]], BarSpacing -> 0, PlotLabel -> NumberForm[Pi / n * Total[N@Sin@Range[0, Pi - Pi / n, Pi / n]], 4]], Plot[Sin[x], {x, 0, Pi}]], {n, 5, 100}]

Out[1]= DynamicModule[«8»]
```

---

Create an overlapped proportional area chart:

```wl
In[1]:= data = {35, 28, 10};

In[2]:= RectangleChart[Table[ConstantArray[Sqrt[d], 2], {d, data}], BarSpacing -> {0, 0}, ChartLayout -> "Overlapped", ChartLabels -> Placed[data, {0.94, 0.92}]]

Out[2]= [image]
```

---

Create a rectangle chart of the atomic weight and abundance of elements in the Earth's crust:

```wl
In[1]:= data = Cases[Table[Tooltip[QuantityMagnitude@{ElementData[e, "CrustAbundance"], ElementData[e, "AtomicWeight"]}, e], {e, ElementData[]}], Tooltip[{c_ ? NumericQ, a_ ? NumericQ}, _] /; c > 0.01 && a > 0.01];
```

Mouse over the bars to get the element names:

```wl
In[2]:= RectangleChart[data, BarSpacing -> {0, 0}, ChartStyle -> "SandyTerrain"]

Out[2]= [image]
```

---

Compare sales and profitability:

```wl
In[1]:=
totalSales = {38, 24, 20, 18};
profitability = {13, 23, 7, 11};
data = Transpose[{totalSales, profitability}];
options = {BarOrigin -> Left, BarSpacing -> {0, 0}, ChartLabels -> Placed[{"Product A", "Product B", "Product C", "Product D"}, Center], AxesLabel -> {"Profitability (%)", "Total Sales (%)"}};

In[2]:= RectangleChart[data, options]

Out[2]= [image]
```

Label the exact values on the $y$ axis:

```wl
In[3]:= labeler[{x_, y_}, ___] := Placed[Row[{y, "%"}], Before]

In[4]:= RectangleChart[data, options, LabelingFunction -> labeler, Ticks -> {Automatic, None}]

Out[4]= [image]
```

---

Click the bars to hear the name of the country, its GDP per capita, and population:

```wl
In[1]:=
countries = {"Sweden", "Luxembourg", "Estonia", "Portugal", "Bulgaria", "Slovenia", "Austria"};
properties = {"Population", "GDPPerCapita"};

In[2]:= data = Table[With[{v = cp}, Button[v[[2 ;; 3]], Speak[StringJoin[ToString /@ {v[[1]], ", Population: ", Round[v[[2]]], ", GDP per capita: $", Round[v[[3]]]}]]]], {cp, Table[Prepend[Table[CountryData[c, p], {p, properties}], c], {c, countries}]}];

In[3]:= RectangleChart[data, AxesLabel -> properties, ChartLabels -> Placed[countries, Tooltip], BarSpacing -> {0, 0.01}]

Out[3]= [image]
```

---

Create a rectangle chart of average hourly earnings of persons employed on works projects:

```wl
In[1]:=
data = |    |    |                                         |
| -- | -- | --------------------------------------- |
| 13 | 40 | "goods"                                 |
| 3  | 42 | "sanitation and health"                 |
| 34 | 46 | "highways, roads, and streets"          |
| 5  | 47 | "conservation"                          |
| 4  | 48 | "miscellaneous"                         |
| 9  | 51 | "sewer systems and other utilities"     |
| 2  | 52 | "airports and other transportation"     |
| 9  | 57 | "parks and other recreation facilities" |
| 9  | 65 | "public buildings"                      |
| 12 | 68 | "white collar"                          |;
avgEarnings = Mean[data[[All, 2]]];
avgLine = {Dashed, Text["Average for All Types", {25, avgEarnings}, {0, -1}], Line[{{0, avgEarnings}, {100, avgEarnings}}]};

In[2]:= RectangleChart[data[[All, 1 ;; 2]], ChartLabels -> Placed[data[[All, 3]], Center, Rotate[#, Pi / 2]&], BarSpacing -> {0, 0}, Frame -> True, Epilog -> avgLine, FrameLabel -> {Column[{"Percent of Total Hours on Which Payment Was Based", "100% = 1,976,000,000 Hours"}, Alignment -> Center], "Average Earnings in Dollars per Hour"}]

Out[2]= [image]
```

---

Create a chart of the proportion of the working population covered by insurance:

```wl
In[1]:=
inputData = |      |      |                                            |
| ---- | ---- | ------------------------------------------ |
| 5.8  | 95.8 | "Extraction of Minerals and Forestry"      |
| 28.4 | 90.3 | "Manufacturing and Mechanical Industries"  |
| 15.4 | 62.7 | "Trade"                                    |
| 5.7  | 62.7 | "Unspecified Industries and Services"      |
| 9.1  | 48.4 | "Transportation and Communication"         |
| 9.8  | 32.6 | "Domestic and Personal Service"            |
| 7.0  | 32.4 | "Professional Service"                     |
| 22.8 | 3    | "Agriculture, Fishing, and Public Service" |;

In[2]:= data = Table[Insert[d, 100 - d[[2]], 3], {d, inputData}];

In[3]:=
Clear@labeler
labeler[{x_, y_}, {r_, 1}, ___] := Placed[{x, y}, {Before, Center}]
labeler[{x_, y_}, {r_, c_}, ___] := Placed[y, Center]

In[4]:=
RectangleChart[Partition[#, 2]& /@ data[[All, {1, 2, 1, 3}]], ChartLabels -> {Placed[data[[All, 3]], Tooltip], None}, ChartStyle -> {LightGray, LightRed}, LabelingFunction -> labeler, BarOrigin -> Left, ChartLayout -> "Stacked", BarSpacing -> {0, 0.01}, AxesLabel -> {None, "% of Total
Working Force"}, ChartLegends -> Placed[{"% Covered", "% Not Covered"}, Below]]

Out[4]= [image]
```

---

Visualize units sold and where they were sold:

```wl
In[1]:=
domesticSales = {58, 22, 10, 35};
exportSales = {12, 59, 50, 27};
intercompanySales = {30, 19, 40, 48};
units = {98, 27, 48, 77};
products = {"Product A", "Product B", "Product C", "Product D"};
data = Table[Labeled[{{units[[i]], domesticSales[[i]]}, {units[[i]], exportSales[[i]]}, {units[[i]], intercompanySales[[i]]}}, products[[i]], After], {i, Length[units]}];

In[2]:= RectangleChart[data, BarOrigin -> Left, BarSpacing -> None, ChartLayout -> "Percentile", AxesLabel -> {"Percent", "Units"}, ChartLegends -> Placed[{"Domestic sales", "Export sales", "Intercompany sales"}, Above]]

Out[2]= [image]
```

---

Compare GDP per capita to population among a list of European countries:

```wl
In[1]:=
countries = {"Luxembourg", "Estonia", "Sweden", "Portugal", "Bulgaria", "Slovenia", "Austria"};
properties = {"GDPPerCapita", "Population"};
data = Table[CountryData[c, p], {c, countries}, {p, properties}];

In[2]:= tooltipLabel[v_, {r_, c_}, ___] := Placed[Grid[{{countries[[c]]}, {"GDPPerCapita", v[[1]]}, {"Population", v[[2]]}}, Alignment -> Left], Tooltip]
```

Mouse over the rectangles to get a summary for each country:

```wl
In[3]:= RectangleChart[data, LabelingFunction -> tooltipLabel, ChartStyle -> 61, AxesLabel -> properties, ChartLegends -> Placed[countries, Below], ImageSize -> 400]

Out[3]= [image]
```

---

Mouse over the rectangles to get a summary for each country:

```wl
In[1]:=
countries = {"Canada", "France", "Italy", "Germany", "Japan", "Russia", "UnitedKingdom"};
gdp = CountryData[#, {"GDP", 2006}]& /@ countries;
gdpPerCapita = CountryData[#, {"GDPPerCapita", 2006}]& /@ countries;
population = CountryData[#, {"Population", 2006}]& /@ countries;
data = Transpose[{gdp, population}];
legends = gdpPerCapita;

In[2]:= RectangleChart[data, LabelingFunction -> (Placed[#, Tooltip, Style[Column[{Row[{"GDP (x-axis) : $", First@#}], Row[{"Population (y-axis) : ", Last@#}], Row[{"GDP Per Capita : $", First@# / Last@#}]}, Alignment -> {Left, Bottom}, Frame -> True], 14, FontFamily -> "Helvitica"]&]&), ChartStyle -> 2, ChartLabels -> Placed[countries, Below, Rotate[Style[#, 12, FontFamily -> "Helvitica", Darker@Brown], Pi / 2]&], PlotLabel -> Style["Visualizing GDP per Capita", 14, Bold, FontFamily -> "Helvitica", Darker@Brown], PlotRange -> All, ChartLegends -> Placed[SwatchLegend[legends, LegendLayout -> "Column"], After]]

Out[2]= [image]
```

---

Visually screen companies by comparing earnings and PE ratios:

```wl
In[1]:=
companies = {"AAPL", "MSFT", "GOOG", "INTC", "CSCO", "JPM", "BAC", "GS", "WFC", "MCD", "PEP", "GIS", "MRK", "PFE", "GSK", "XOM", "PSX", "OXY", "SLB"};
properties = {"EarningsPerShare", "PERatio"};
data = Table[FinancialData[c, p], {c, companies}, {p, properties}];
```

Define a labeling function to place company information in a tooltip:

```wl
In[2]:= tooltipLabel[v_, {r_, c_}, ___] := Placed[Grid[{{FinancialData[companies[[c]], "Name"]}, {"Earnings", v[[1]]}, {"PE Ratio", v[[2]]}}, Alignment -> Left], Tooltip]
```

Mouse over the bars to get company information:

```wl
In[3]:= RectangleChart[data, BarSpacing -> {0, 0}, LabelingFunction -> tooltipLabel, ChartStyle -> 24, AxesLabel -> properties, ImageSize -> 500]

Out[3]= [image]
```

---

Create bar codes:

```wl
In[1]:=
digitToBarWidths[0] = {3, 2, 1, 1};
digitToBarWidths[1] = {2, 2, 2, 1};
digitToBarWidths[2] = {2, 1, 2, 2};
digitToBarWidths[3] = {1, 4, 1, 1};
digitToBarWidths[4] = {1, 1, 3, 2};
digitToBarWidths[5] = {1, 2, 3, 1};
digitToBarWidths[6] = {1, 1, 1, 4};
digitToBarWidths[7] = {1, 3, 1, 2};
digitToBarWidths[8] = {1, 2, 1, 3};
digitToBarWidths[9] = {3, 1, 1, 2};
digitToBarWidths["Invert"] = {1, 1, 1, 1, 1};
digitToBarWidths["Start"] = {1, 1, 1};
digitToBarWidths["Stop"] = {1, 1, 1};

In[2]:= barWidths[upc_List] := Module[{midpt = Floor[Length[upc] / 2]}, digitToBarWidths /@ Flatten[{"Start", Take[upc, midpt], "Invert", Drop[upc, midpt], "Stop"}]]

In[3]:=
makeBarCode[upc_String] := makeBarCode[ToExpression /@ Characters[upc]]
makeBarCode[upc_List] := RectangleChart[Table[{w, 1}, {w, Flatten[barWidths[upc]]}], BarSpacing -> {0, 0}, ChartBaseStyle -> EdgeForm[], ChartStyle -> {Black, White}, Axes -> None, PlotLabel -> Row[upc]]

In[4]:= makeBarCode["812686001109"]

Out[4]= [image]
```

### Properties & Relations (4)

Use ``RectangleChart3D`` to get a 3D rendering of a ``RectangleChart``:

```wl
In[1]:= {RectangleChart[{{1, 1}, {1, 2}, {2, 3}}], RectangleChart3D[{{1, 1, 1}, {1, 1, 2}, {2, 1, 3}}]}

Out[1]= {[image], [image]}
```

---

``BarChart`` is a special case of ``RectangleChart``:

```wl
In[1]:= {BarChart[{1, 2, 3}], RectangleChart[{{1, 1}, {1, 2}, {1, 3}}]}

Out[1]= {[image], [image]}
```

---

Use ``SectorChart`` to visualize a list of data as sectors:

```wl
In[1]:= {RectangleChart[{{1, 1}, {1, 2}, {2, 3}}], SectorChart[{{1, 1}, {1, 2}, {2, 3}}]}

Out[1]= {[image], [image]}
```

---

Use ``Histogram3D`` to automatically compute binning and draw histograms:

```wl
In[1]:= Histogram3D[RandomReal[NormalDistribution[0, 1], {200, 2}]]

Out[1]= [image]
```

### Neat Examples (1)

Chartwork:

```wl
In[1]:= RectangleChart[RandomReal[1, {50, 50, 2}], ChartLayout -> "Stacked", Axes -> None, BarSpacing -> {0, 1}, PerformanceGoal -> "Speed"]

Out[1]= [image]
```

## See Also

* [`Histogram`](https://reference.wolfram.com/language/ref/Histogram.en.md)
* [`RectangleChart3D`](https://reference.wolfram.com/language/ref/RectangleChart3D.en.md)
* [`BarChart3D`](https://reference.wolfram.com/language/ref/BarChart3D.en.md)
* [`BubbleChart`](https://reference.wolfram.com/language/ref/BubbleChart.en.md)
* [`SectorChart`](https://reference.wolfram.com/language/ref/SectorChart.en.md)
* [`ListPlot`](https://reference.wolfram.com/language/ref/ListPlot.en.md)
* [`ListLinePlot`](https://reference.wolfram.com/language/ref/ListLinePlot.en.md)
* [`ListLogPlot`](https://reference.wolfram.com/language/ref/ListLogPlot.en.md)
* [`PairedBarChart`](https://reference.wolfram.com/language/ref/PairedBarChart.en.md)
* [`Rectangle`](https://reference.wolfram.com/language/ref/Rectangle.en.md)

## Related Guides

* [Charting and Information Visualization](https://reference.wolfram.com/language/guide/ChartingAndInformationVisualization.en.md)

## History

* [Introduced in 2008 (7.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn70.en.md) \| [Updated in 2010 (8.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn80.en.md) ▪ [2012 (9.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn90.en.md) ▪ [2014 (10.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn100.en.md) ▪ [2017 (11.1)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn111.en.md) ▪ [2018 (11.3)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn113.en.md) ▪ [2021 (13.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn130.en.md) ▪ [2025 (14.2)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn142.en.md) ▪ [2025 (14.3)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn143.en.md)