Plots bar charts in high-resolution graphics.
||General title; default
||Window number for the bar charts; default 1|
||Window number for the key (zero for no key); default 2|
||Width(s) of the bars; default
||What proportion of the space allocated along the x-axis each bar should occupy; default
||Labels for the bars or groups of bars; default
||Whether or not the bars of the bar charts are appended together (
||Direction of the plot (
||What scale to use to label the y-axis (
||Where to draw outlines (
||Pen to use for the outlines; default -9|
||Whether to clear the screen before plotting or to continue plotting on the old screen (
||Overall description for the key; default
||Action to be taken after completing the plot (
||Heights of the bars in each bar chart|
||Heights of error bars plotted above the bars of each bar chart; default 0 i.e. none|
||Heights of error bars plotted below the bars of each bar chart; if any of these is omitted, the corresponding setting of
||Which factor of a 2-way table to use as the groups factor; default uses the second classifying factor|
||Pen number(s) for each bar chart; default
||Pen number(s) for the error bars; default -11|
||Annotation for key|
BARCHART plots high-resolution bar charts. You can plot a single bar chart by setting the
DATA parameter to a one-way table or a variate defining the heights of the bars. To plot several bar charts on the same graph, you can set
DATA to a list of one-way tables or variates. These must all contain the same number of values, and any tables must be classified by the same factor.
Alternatively, you can set
DATA to a two-way table. The
GROUPS parameter then specifies which of the two classifying factors is to be treated as the “groups” factor (by default this is the second factor).
BARCHART now plots a bar chart for every level of the
GROUPS factors, with bars defined by the other classifying factor.
Labels can be supplied for the bars, using the
LABELS option. If this is not set, the labels will be the labels or levels of the factor classifying the
DATA tables, or the integers 1 upwards for a
By default, if there are several bar charts, they are plotted with their bars alongside each other. So
BARCHART first plots the first bar of every bar chart, then the second bar, and so on. Alternatively, you can set option
APPEND=yes to stack the bars. The bottom portion of each bar then corresponds to the first bar chart, and the top to the last bar chart.
You can include error bars in a single bar chart or when several bar charts are plotted alongside each other, by specifying their heights with the
LOWERERRORBARS parameters. The error bars take the form of a horizontal line joined by a vertical line of the specified height, above and below each bar. The
ERRORBARS parameter specifies the heights of the error bars above the bars of the bar chart, and the
LOWERERRORBARS parameter specifies the heights of the error bars below the bars. If
LOWERERRORBARS is not specified, the error bars are assumed to have the same heights below and above the bars. You can set
LOWERERRORBARS to a scalar if the heights are the same for every bar of a bar chart, or to a table or variate if different bars have error bars with different heights.
ORIENTATION option controls whether the bars of the bar chart are plotted vertically (the default) or horizontally. When
ORIENTATION=horizontal, the horizontal axis is taken to be the y-axis, so the same
YAXIS settings can be used however the bar chart is oriented.
By default, Genstat uses pen 2 for the first bar chart, pen 3 for the second bar chart, and so on, so that a different colour or shading is used for each one. Alternatively, you can define your own colours or shading, using the
PEN parameter. If you set
PEN to a scalar, a single pen is used for all the bars. Alternatively, you can specify a variate or a table to define a different pen for each bar. The relevant aspects of the pens should be set in advance, if required, using the
COLOUR parameters of the
PEN directive. Generally, however, the default attributes of the pens will be satisfactory. Similarly, the
PENERRORBARS parameter specifies the pen or pens to use for the error bars (default -11).
The bars in a bar chart usually have equal widths, defined to fill the available space along the x-axis. However, you can set your own widths by setting option
BARWIDTH to either a scalar or a variate or table with as many values as the number of bars. The
BARCOVERING option indicates what proportion of the space allocated along the x-axis each bar should occupy; the default is 0.8 (giving a gap between each bar).
OUTLINE option controls whether lines are drawn around the bars or around the perimeter of the bar chart. These are drawn using the pen specified by the
PENOUTLINE option (default -9). You can suppress all the outlines by setting
WINDOW option defines the window where the bar chart is plotted, and the
KEYWINDOW option similarly specifies where the key should appear. You can set either of these to zero if you want to suppress the corresponding output. Titles can be added to the bar chart and key using the
KEYDESCRIPTION options respectively.
SCREEN option controls whether the graphical display is cleared before the bar chart is plotted and the
ENDACTION option controls whether Genstat pauses at the end of the plot.
The axes of the plot are formed automatically from the data. By default, the upper bound of the y-axis is set to be five percent greater than the height of the longest bar. If any of the bars has a negative height the lower bound is adjusted in a similar way, otherwise it is set to zero. You can control the form of the axes by using the
YAXIS directives to set the required attributes (such as titles) before the
BARCHART directive is used. The
YSCALING option controls the scale used to label the y-axis, with settings
percentage; the default is
The key consists of the title, if set by
KEYDESCRIPTION, followed information about each bar chart. You can specify a description for each bar chart using the
DESCRIPTION parameter. If the
DATA parameter was set to a list of one-way tables or variates, the default description takes the identifier of the table or variate. If
DATA was set to a two-way table, the default descriptions are formed from the labels or levels of the
Commands for: Graphics.
" Example 1:6.3.2 and Figure 1:6.3.2 " FACTOR [LEVELS=!(1999,2000)] Year FACTOR [LABELS=!t(April,June,September,December)] Month TABLE [CLASSIFICATION=Year,Month; VALUES=45000,10000,-24000,11000,\ 21000,34000,-10000,47000] Results BARCHART [TITLE='Profit and loss'] Results