bar, barh

Syntax

bar(tsobj)
bar(tsobj, width)
bar(..., 'style')
hbar = bar(...)
barh(...)
hbarh = barh(...)

Arguments

tsobj

Financial time series object.

width

Width of the bars and separation of bars within a group. (Default = 0.8.) If width is 1, the bars within a group touch one another. Values > 1 produce overlapping bars.

style

'grouped' (default) or 'stacked'.

Description

bar, barh draw vertical and horizontal bar charts.

bar(tsobj) draws the columns of data series of the object tsobj. The number of data series dictates the number of vertical bars per group. Each group is the data for one particular date.

bar(tsobj, width) specifies the width of the bars.

bar(..., 'style') changes the style of the bar chart.

hbar = bar(...) returns a vector of bar handles.

Use the MATLAB® command shading faceted to put edges on the bars. Use shading flat to turn edges off.

Examples

expand all

Create a Bar Chart for a Stock

This example shows how to create a bar chart for Disney stock showing high, low, opening, and closing prices.

load disney
bar(q_dis)
title('Bar Chart of Disney Prices')

Create a Horizontal Bar Chart for a Stock

This example shows how to create a horizontal bar chart for Disney stock showing high, low, opening, and closing prices.

load disney
barh(q_dis)
title('Horizontal Bar Chart of Disney Prices')

Was this topic helpful?