The BAR_PLOT procedure creates a bar graph.
This routine is written in the IDL language. Its source code can be found in the file
subdirectory of the IDL distribution.
A string array, containing one string label per bar. If the bars are vertical, the labels are placed beneath them. If horizontal (rotated) bars are specified, the labels are placed to the left of the bars.
A scalar that specifies the offset to be applied to the first bar, in units of "nominal bar width". This keyword allows, for example, different groups of bars to be overplotted on the same graph. If not specified, the default offset is equal to BARSPACE.
A scalar that specifies, in units of "nominal bar width", the spacing between bars. For example, if BARSPACE is 1.0, then all bars will have one bar-width of space between them. If not specified, the bars are spaced apart by 20% of the bar width.
A floating-point value that specifies the width of the bars in units of "nominal bar width". The nominal bar width is computed so that all the bars (and the space between them, set by default to 20% of the width of the bars) will fill the available space (optionally controlled with the BASERANGE keyword).
A floating-point scalar in the range 0.0 to 1.0, that determines the fraction of the total available plotting area (in the direction perpendicular to the bars) to be used. If not specified, the full available area is used.
A vector, the same size as Values , containing the color index to be used for each bar. If not specified, the colors are selected based on spacing the color indices as widely as possible within the range of available colors (specified by !D.N_COLORS).
For example, if ARRAY is a two-dimensional array of 5 columns and 8 rows, it is natural to make a plot with 5 bars, each of which is a "stacked" composite of 8 sections. First, create a 2D COLORS array, equal in size to ARRAY, that has identical color index values across each row to ensure that the same item is represented by the same color in all bars.
To plot each row of ARRAY as a clustered group of bars within the same graph, use the BASERANGE keyword to restrict the available plotting region for each set of bars. The sample code fragment below illustrates this method: