Plots a 2D bar graph that can include stacked and grouped bars, as well as various color and fill pattern options.
y
If y is a 2D array and the Stack keyword is set, then the first dimension is construed as a stack and the second dimension as a bar value.
If y is a 3D array, then the first dimension is construed as a group, the second as the stack, and the third as a bar in a stack in a group. The Stack keyword is not relevant.
Keywords
NOTE: Each of these plotting options is discussed in the Examples section.
FillColors
FillLinestyle
NOTE: This keyword has no effect unless either FillSpacing or FillOrientation are used.
Index | X Windows Style | Windows Style |
---|---|---|
0 | Solid | Solid |
1 | Dotted | Short dashes |
2 | Dashed | Long dashes |
3 | Dash dot | Long-short dashes |
4 | Dash-dot-dot-dot | Long-short-short dashes |
5 | Long dashes | Long dashes |
FillSpacing
FillThick
NOTE: This keyword has no effect unless either FillSpacing or FillOrientation are used.
LegendBoxColor
LegendCharSize
LegendLabels
LegendPosition
LegendTextColor
LineColors
OutlineColor
Stacked
XTickName
YTickName
Additional BAR keywords are listed below. For a description of each keyword, see Chapter 3, Graphics and Plotting Keywords, in the PV-WAVE Reference.
[XY]Range | Noerase | [XY]Title |
Position | Title |
Either the FillLineStyle or FillOrientation keyword (or both) must be specified to fill the bars with lines.
A stacked bar is a bar that depicts more than one value, where each value is shown on top of the previous value. A group is a set of two or more related bars appearing next to one another on the chart. It is possible to create grouped bars that are also stacked. Refer to the following examples for information on producing stacked and grouped bar charts.
The BAR2D procedure also draws bar graphs; however, it does not permit stacked and grouped bars.
; The following expressions create an array of data to plot (the ; bar values) and tick names for the x and y-axes. simple = [ 10, 20, 10, 40] XTickNames=["Quarter 1", "Quarter 2", "Quarter 3", "Quarter 4"] YTickNames=["$ 0000", "$ 1000", "$ 2000", "$ 3000"] ; ; The following expression creates a 2D array specifying data for ; four groups of bars containing three sets of bars per group. ; group1 = [ [ 100, 200, 100], [200, 150, 100], [400, 200, 100], $
[100, 110, 120]]
; ; The following expression creates a 3D array specifying data for ; two groups of bars containing three stacks with two values per ; stack. ; group2 = [ [ [10, 20], [30, 40], [100, 60]], $
[ [30, 10], [50, 50], [60, 40]]]
BAR, simple, XTickName=XTickNames, YTickName=YTickNames, $
FillOrientation=[30, 10, 0, 90], LineCol=[1,3,5,7], Outline=4, $
Fillcolors=[4, 5, 7, 1], Filllinestyle=[1,2,3,4], $
Fillthick=[1,2,3,4], $
LegendLabel=["EAST", "NORTH", "WEST", "SOUTH"], $
LegendTextColor=5, LegendCharSize=2, $
LegendPosition=[0.00, 0.3, 0.22, 0.6], $
Position=[0.3, 0.1, 0.95, 0.95], $
/Horizontal, Title="Patterned Horizontal Bar"
Figure 2-1 A horizontal bar chart with a legend. The bars are filled with colors and lines.
BAR, group1, XTickName=XTickNames, YTickName=YTickNames, $
FillOrientation=[30, 0, 90], LineCol=[1,5,7], Outline=8, $
Fillcolors=[4, 7, 1], FillLinestyle=[1,3,4], $
fillthick=[1,3,4], $
LegendLabel=["EAST", "NORTH", "SOUTH"], LegendTextColor=3, $
LegendCharSize=2, /DrawLegendBox, $
LegendPosition=[0.79, 0.7, 0.99, 0.9], $
Position=[0.1, 0.1, 0.8, 0.95], $
Title="Grouped Bars"
Figure 2-2 A bar chart with grouped bars and a legend. The bars are filled with colors and line.
BAR, group1, XTickName=XTickNames, $
FillOrientation=[30, 0, 90], LineCol=[1,5,7], Outline=8, $
filllinestyle=[1,3,4] , $
LegendLabel=["EAST", "NORTH", "SOUTH"], LegendTextColor=1, $
LegendCharSize=2.0, /DrawLegendBox,$
LegendPosition=[0.79, 0.7, 0.99, 0.9], $
Position=[0.2, 0.1, 0.8, 0.95],$
/Stacked, Title="Stacked Bars"
Figure 2-3 A bar chart with grouped and stacked bars. This plot includes a legend and line filled bars.See Also