WOLFRAM

BarChart[{y1,y2,,yn}]

makes a bar chart with bar lengths y1, y2, .

BarChart[{,wi[yi,],,wj[yj,],}]

makes a bar chart with bar features defined by the symbolic wrappers wk.

BarChart[{data1,data2,}]

makes a bar chart from multiple datasets datai.

Details and Options

Examples

open allclose all

Basic Examples  (4)Summary of the most common use cases

Generate a bar chart for a list of heights:

Out[1]=1

Chart several datasets:

Out[1]=1

Use categorical labels:

Out[1]=1

Categorical legends:

Out[2]=2

Set the style for bars:

Out[1]=1

Pictorial bars:

Out[2]=2

Scope  (42)Survey of the scope of standard use cases

Data and Layouts  (15)

Items in a dataset are grouped together:

Out[1]=1

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

Out[1]=1

Nonreal data is taken to be missing and typically yields a gap in the bar chart:

Out[1]=1

The data may include units:

Out[1]=1

Specify the units to use:

Out[1]=1

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

Out[1]=1

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

Out[1]=1

Use the keys as labels:

Out[2]=2

Use the keys as callouts:

Out[3]=3

Use the keys as legends:

Out[4]=4

Associations can be nested:

Out[1]=1

The weights in WeightedData are ignored:

Out[1]=1

The censoring and truncation information in EventData is ignored:

Out[2]=2

Use different layouts to display multiple datasets:

Out[1]=1

Stacked layouts are more compact in the horizontal direction:

Out[1]=1

Use Joined to indicate connections between data points:

Out[2]=2
Out[1]=1

Use a column of charts instead:

Out[2]=2

Use multiple rows or columns:

Out[3]=3

Control the origin of bars:

Out[1]=1

Adjust the spacing between bars and groups of bars:

Out[1]=1

Plot data with uncertainty:

Out[1]=1

Tabular Data  (1)

Get tabular data, counted by the "class" and "survived" columns:

Out[1]=1

Create a chart of how many passengers were in each ticket class:

Out[2]=2
Out[3]=3

Show how many passengers survived and how many perished:

Out[4]=4
Out[5]=5

Display the number of passengers who survived by ticket class:

Out[6]=6
Out[7]=7

Use stacked bars for the display:

Out[8]=8

Wrappers  (5)

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

Out[1]=1

Wrappers can be nested:

Out[1]=1

Override the default tooltips:

Out[1]=1

Use any object in the tooltip:

Out[2]=2

Use PopupWindow to provide additional drilldown information:

Out[1]=1

Button can be used to trigger any action:

Out[1]=1

Styling and Appearance  (8)

Use an explicit list of styles for the bars:

Out[1]=1

Use any gradient or indexed color schemes from ColorData:

Out[1]=1

Use color schemes designed for charting:

Out[1]=1
Out[2]=2

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

Out[1]=1

Style can be used to override styles:

Out[1]=1

Use any graphic for pictorial bars:

Out[1]=1

Use built-in programmatically generated bars:

Out[1]=1
Out[2]=2

For detailed settings use Palettes ChartElementSchemes:

Out[3]=3

Use a theme with detailed frame ticks and grid lines:

Out[1]=1

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

Out[2]=2

Labeling and Legending  (13)

Use Labeled to add a label to a bar:

Out[1]=1

Use symbolic positions for label placement:

Out[1]=1
Out[2]=2

Provide categorical labels for the columns of data:

Out[1]=1

For rows of data:

Out[2]=2

For both:

Out[3]=3

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

Out[1]=1

Use Callout to add a label to a bar:

Out[1]=1

Change the appearance of the callout:

Out[1]=1

Automatically position callouts:

Out[1]=1

Use callouts with stacked bars:

Out[2]=2

Provide value labels for bars by using LabelingFunction:

Out[1]=1

Use Placed to control placement and formatting:

Out[2]=2

Use Callout to create callouts:

Out[1]=1

Add categorical legend entries for the columns of data:

Out[1]=1

For rows of data:

Out[2]=2

Use Legended to add additional legend entries:

Out[1]=1

Use Placed to affect the positioning of legends:

Out[1]=1

Options  (133)Common values & functionality for each option

AspectRatio  (3)

By default, BarChart uses a fixed ratio of height to width for the chart:

Out[2]=2

The ratio is not affected when the bars are horizontal:

Out[3]=3

Make the height the same as the width with AspectRatio1:

Out[1]=1

AspectRatioFull adjusts the height and width to tightly fit inside other constructs:

Out[2]=2

Axes  (3)

By default, axes are drawn:

Out[1]=1

Use AxesFalse to turn off axes:

Out[1]=1

Use AxesOrigin to specify where the axes intersect:

Out[1]=1

AxesLabel  (4)

No axes labels are drawn by default:

Out[2]=2

Place a label on the axis:

Out[1]=1

Specify axes labels:

Out[1]=1

Use units as labels:

Out[1]=1

AxesOrigin  (2)

The position of the axes is determined automatically:

Out[1]=1

Specify an explicit origin for the axes:

Out[1]=1

AxesStyle  (4)

Change the style for the axes:

Out[2]=2

Specify the style of each axis:

Out[1]=1

Use different styles for the ticks and the axes:

Out[1]=1

Use different styles for the labels and the axes:

Out[1]=1

BarOrigin  (1)

Change the bar origin:

Out[1]=1

BarSpacing  (5)

Use automatically determined spacing between bars:

Out[1]=1

Use no spacing:

Out[1]=1

Use symbolic presets:

Out[1]=1

Use explicit spacing between bars:

Out[1]=1

Use explicit spacing between bars and groups of bars:

Out[1]=1

ChartBaseStyle  (5)

Use ChartBaseStyle to style bars:

Out[1]=1
Out[2]=2
Out[3]=3

ChartBaseStyle combines with ChartStyle:

Out[1]=1

ChartStyle may override settings for ChartBaseStyle:

Out[1]=1

ChartBaseStyle combines with Style:

Out[1]=1

Style may override settings for ChartBaseStyle:

Out[2]=2

ChartBaseStyle combines with ColorFunction:

Out[1]=1

ColorFunction may override settings for ChartBaseStyle:

Out[2]=2

ChartElementFunction  (6)

Get a list of built-in settings for ChartElementFunction:

Out[1]=1

For detailed settings, use Palettes ChartElementSchemes:

Out[1]=1
Out[2]=2

This ChartElementFunction is appropriate to show the global scale:

Out[1]=1

Write a custom ChartElementFunction:

Out[2]=2
Out[4]=4

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

Out[3]=3

Built-in element functions may have options; use Palettes ChartElementSchemes to set them:

Out[1]=1
Out[2]=2

ChartElements  (9)

Create a pictorial chart based on any Graphics object:

Out[1]=1

Graphics3D:

Out[2]=2

Image:

Out[3]=3

Use a stretched version of the graphic:

Out[1]=1

Use explicit sizes for width and height:

Out[1]=1

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

Out[2]=2

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

Out[1]=1

Use a different graphic for each column of data:

Out[1]=1

Use a different graphic for each row of data:

Out[2]=2

Graphics are used cyclically:

Out[1]=1

Styles are inherited from styles set through ChartStyle etc.:

Out[1]=1

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

Out[2]=2

The orientation of the pictorial graphic is unaffected by BarOrigin:

Out[1]=1

Create true 3D shaded bars:

Out[2]=2

ChartLabels  (10)

By default, labels are placed in the axis:

Out[1]=1

Labeled wrappers in data will place additional labels:

Out[2]=2

Use Placed to control label placement:

Out[1]=1

Symbolic positions outside the bar:

Out[1]=1
Out[2]=2

Coordinate-based placement relative to a bar:

Out[1]=1

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

Out[1]=1

Use the third argument to Placed to control formatting:

Out[1]=1
Out[2]=2

Use a hyperlink label:

Out[3]=3

Rotate the labels:

Out[4]=4

By default, labels are associated with columns of data:

Out[1]=1

Associate labels with rows or datasets:

Out[2]=2

Label both rows and columns:

Out[3]=3

Use Placed to affect placements:

Out[1]=1

Use Callout to connect the labels to the bars:

Out[1]=1

Place multiple labels:

Out[1]=1

ChartLayout  (5)

ChartLayout is grouped by default:

Out[1]=1

Use stepped bars:

Out[1]=1

Use stacked bars:

Out[1]=1

The stacked layout can effectively display many datasets:

Out[2]=2

Show changes for different categories by setting Joined->True:

Out[3]=3

Place individual charts in a column:

Out[1]=1

Use a row instead of a column:

Out[2]=2

Use multiple columns or rows:

Out[1]=1

Prefer full columns or rows:

Out[2]=2

ChartLegends  (8)

Generate a legend based on chart style:

Out[1]=1

Use Legended to add additional legend entries:

Out[1]=1

Use Legended to specify individual legend entries:

Out[1]=1

Legended adds additional legend entries:

Out[1]=1

Generate a legend for datasets:

Out[1]=1

Unused legend labels are dropped:

Out[1]=1

Legends can be applied to several dimensions:

Out[1]=1

Use Placed to control the placement of legends:

Out[1]=1

ChartStyle  (8)

Use ChartStyle to style bars:

Out[1]=1

Give a list of styles:

Out[1]=1

Use the "Gradients" color scheme from ColorData:

Out[2]=2

Use the "Indexed" color scheme from ColorData:

Out[3]=3

Use indexed colors optimized for charting:

Out[1]=1
Out[2]=2

Styles are used cyclically:

Out[1]=1

Style each column of data:

Out[1]=1

Style each row of data:

Out[2]=2

Style both rows and columns of data:

Out[3]=3

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

Out[4]=4

Style overrides settings for ChartStyle:

Out[1]=1
Out[2]=2

ColorFunction overrides settings for ChartStyle:

Out[1]=1
Out[2]=2

ChartElements may override settings for ChartStyle:

Out[1]=1

ColorFunction  (3)

Color by bar height:

Out[1]=1

Use ColorFunctionScaling->False to get unscaled height values:

Out[1]=1

ColorFunction overrides styles in ChartStyle:

Out[1]=1

Use ColorFunction to combine different style effects:

Out[2]=2

ColorFunctionScaling  (2)

By default, scaled height values are used:

Out[1]=1

Use ColorFunctionScaling->False to get unscaled height values:

Out[1]=1

Frame  (4)

BarChart does not use a frame by default:

Out[1]=1

Use FrameTrue to turn on the frame:

Out[1]=1

Draw a frame on the left and right edges:

Out[1]=1

Draw a frame on the left and top edges:

Out[1]=1

FrameLabel  (3)

Place a label along the bottom of a chart:

Out[2]=2

Frame labels are placed on the bottom and left frame edges by default:

Out[1]=1

Place labels on each of the edges in the frame:

Out[1]=1

FrameStyle  (2)

Specify the style of the frame:

Out[1]=1

Specify style for each frame edge:

Out[1]=1

FrameTicks  (8)

Frame ticks are placed automatically by default:

Out[1]=1

Use All to include tick labels on all edges:

Out[1]=1

Place tick marks at specified positions:

Out[1]=1

Draw frame tick marks at the specified positions with specific labels:

Out[1]=1

Specify the lengths for tick marks as a fraction of the graphics size:

Out[1]=1

Use different sizes in the positive and negative directions for each tick mark:

Out[1]=1

Specify a style for each frame tick:

Out[1]=1

Construct a function that places frame ticks at the midpoint and extremes of the frame edge:

Out[2]=2

FrameTicksStyle  (3)

By default, the frame ticks and frame tick labels use the same styles as the frame:

Out[2]=2

Specify an overall style for the ticks, including the labels:

Out[1]=1

Use different style for each frame edge:

Out[1]=1

ImageSize  (7)

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

Out[1]=1

Specify the width of the plot:

Out[1]=1

Specify the height of the plot:

Out[2]=2

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

Out[1]=1

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

Out[1]=1

Setting AspectRatioFull will fill the available space:

Out[2]=2

Use maximum sizes for the width and height:

Out[1]=1

Use ImageSizeFull to fill the available space in an object:

Out[1]=1

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

Out[1]=1

IntervalMarkers  (2)

By default, uncertainties are capped:

Out[1]=1

Use "Bars" to denote uncertainties without caps:

Out[1]=1

IntervalMarkersStyle  (2)

Interval markers contrast with the bars by default:

Out[1]=1

Use multiple datasets:

Out[2]=2

Specify the style for uncertainties:

Out[1]=1

Joined  (3)

By default, bars are not joined:

Out[1]=1

Join the centers of the tops of the bars:

Out[1]=1

Join the corners of the bars:

Out[2]=2

Join stacked bars:

Out[1]=1

LabelingFunction  (8)

Use automatic labeling by values through Tooltip and StatusArea:

Out[1]=1

Do no labeling:

Out[1]=1

Use symbolic positions to control label placement:

Out[1]=1

Symbolic positions outside the bar:

Out[1]=1
Out[2]=2

Coordinate-based placement relative to a bar:

Out[1]=1

Use Callout to place labels automatically:

Out[1]=1

Use symbolic positions to place Callout labels:

Out[2]=2

Control the formatting of labels:

Out[1]=1

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

Out[1]=1

Place complete labels as tooltips:

Out[2]=2

LabelingSize  (4)

Textual labels are shown at their actual sizes:

Out[4]=4

Image labels are automatically resized:

Out[1]=1

Specify a maximum size for textual labels:

Out[1]=1

Specify a maximum size for image labels:

Out[2]=2

Show image labels at their natural sizes:

Out[1]=1

PerformanceGoal  (3)

Generate a bar chart with interactive highlighting:

Out[1]=1

Emphasize performance by disabling interactive behaviors:

Out[1]=1

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

Out[1]=1

PlotTheme  (2)

Use a theme with simple ticks and grid lines in a high-contrast color scheme:

Out[1]=1

Change the color scheme:

Out[1]=1

ScalingFunctions  (4)

By default, plots have linear scales in each direction:

Out[1]=1

Use a log scale in the direction:

Out[1]=1

Use a scale defined by a function and its inverse:

Out[1]=1

Positions in Ticks and GridLines are automatically scaled:

Out[1]=1

Applications  (11)Sample problems that can be solved with this function

Create a bar chart of the frequency of characters in the Declaration of Independence:

Out[1]=1

Apply labels at multiple levels:

Out[2]=2

Click the color selector and see the bar chart of updated color components:

Out[1]=1

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

Out[2]=2

Create a progressive bar chart:

Out[2]=2

Create a progressive column graph:

Out[4]=4

Create a Gantt chart of employees' holidays in January:

Mouse over the bars and grid lines for the number of days:

Out[4]=4

Use images of textures from ExampleData as pictorial bars:

Color the textures:

Out[4]=4

Create a bar chart with textured bars:

Out[5]=5

Acoustically compare the percentage price change of a list of companies:

Click a dataset in the bar chart to hear an acoustic representation of the values:

Out[3]=3

Compare price trends for a portfolio of companies:

Create a labeling function:

Mouse over the bars to get price information:

Out[3]=3

Compare common length measures in centimeters:

Out[1]=1

Properties & Relations  (6)Properties of the function, and connections to other functions

Use BarChart3D to get a 3D rendering of bar charts:

Out[1]=1

BarChart is a special case of RectangleChart:

Out[1]=1

Use PieChart and PieChart3D to visualize a list of data as sectors:

Out[1]=1

Use ListPlot and ListLinePlot to produce line graphs:

Out[1]=1

Use Histogram to automatically compute binning and draw histograms:

Out[1]=1

Use PairedBarChart to create bilateral bar charts:

Out[1]=1

Neat Examples  (3)Surprising or curious use cases

Chartwork with stacked bars:

Out[1]=1

Chartwork with stacked bars:

Out[1]=1

Chartwork with percentile bars:

Out[1]=1
Wolfram Research (2008), BarChart, Wolfram Language function, https://reference.wolfram.com/language/ref/BarChart.html (updated 2025).
Wolfram Research (2008), BarChart, Wolfram Language function, https://reference.wolfram.com/language/ref/BarChart.html (updated 2025).

Text

Wolfram Research (2008), BarChart, Wolfram Language function, https://reference.wolfram.com/language/ref/BarChart.html (updated 2025).

Wolfram Research (2008), BarChart, Wolfram Language function, https://reference.wolfram.com/language/ref/BarChart.html (updated 2025).

CMS

Wolfram Language. 2008. "BarChart." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/BarChart.html.

Wolfram Language. 2008. "BarChart." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/BarChart.html.

APA

Wolfram Language. (2008). BarChart. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BarChart.html

Wolfram Language. (2008). BarChart. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BarChart.html

BibTeX

@misc{reference.wolfram_2025_barchart, author="Wolfram Research", title="{BarChart}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/BarChart.html}", note=[Accessed: 26-March-2025 ]}

@misc{reference.wolfram_2025_barchart, author="Wolfram Research", title="{BarChart}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/BarChart.html}", note=[Accessed: 26-March-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_barchart, organization={Wolfram Research}, title={BarChart}, year={2025}, url={https://reference.wolfram.com/language/ref/BarChart.html}, note=[Accessed: 26-March-2025 ]}

@online{reference.wolfram_2025_barchart, organization={Wolfram Research}, title={BarChart}, year={2025}, url={https://reference.wolfram.com/language/ref/BarChart.html}, note=[Accessed: 26-March-2025 ]}