using GMT
bar(rand(10), show=true)
Reads (x,y) pairs and plots a bar graph. This module is a subset of plot to make it simpler to draw bar plots. So not all (fine) controlling parameters are listed here. For a finer control, user should consult the plot module.
If input is a MxN array and N > 2 it will plot a bar-group with M groups and N-1 bars in each group (first column holds always the coordinates).
B or axes or frame
Set map boundary frame and axes attributes. Default is to draw and annotate left, bottom and vertical axes and just draw left and top axes. More at [frame](../common_opts/opt_B.html)
J or proj or projection : – proj=
Select map projection. More at [proj](../common_opts/opt_J.html)
R or region or limits : – limits=(xmin, xmax, ymin, ymax) | limits=(BB=(xmin, xmax, ymin, ymax),) | limits=(LLUR=(xmin, xmax, ymin, ymax),units=“unit”) | …more
Specify the region of interest. More at [limits](../common_opts/opt_R.html). For perspective view view, optionally add zmin,zmax. This option may be used to indicate the range used for the 3-D axes. You may ask for a larger w/e/s/n region to have more room between the image and the axes.
G or markerfacecolor or MarkerFaceColor or markercolor or mc or fill
Select color or pattern for filling of symbols [Default is no fill]. Note that plot will search for fill and pen settings in all the segment headers (when passing a GMTdaset or file of a multi-segment dataset) and let any values thus found over-ride the command line settings (but those must be provided in the terse GMT syntax). See [Setting color](../common_features/color.html) for extend color selection (including color map generation).
bar
Vertical bar extending from base to y. By default, base is 0 and the bar widths are 0.8 of the width in x-units. You can change this by using (in alternative):
cm, inch or point.cm, inch or point.bargap
Controls the gap between the bars. The default is to let a space of 20% of the bar width but this can be changed by providing eithe a gap in the [0-1] interval or in percentage. i.e. bargap=40 or bargap=0.4 will create a space of 40% between the bars.
hbar
Horizontal bar extending from base to x. Same as bar but now with respect to y axis, except that one cannot use width or base to change just those defaults (the use of it is restricted to the vertical bars case).
fill=[“color1”, “color2”, …] | fill=(“color1”, “color2”, …) | fill=(1,2,…)
List of colors used to wrapp the bars inside each group. When using numbers that means patterns codes.
fillalpha=[…]
When fill was used, control the transparency level. Numbers can be floats <= 1.0 or integeres in 0-100 range.
stack
Plot a vertically (or horizontally if hbar=true) stacked group plot. The particular setting stack=:waterfall creates a waterfall chart, which is a form of data visualization that helps in understanding the cumulative effect of sequentially introduced positive or negative values. The input data for this option is a vector or one row matrix with the heights of each bar. A height o zero (0) has the special meaning of plotting the total accumulated up to that value. For these plots we can connect the bars with the connector=true or connector=pen option. Bar colors (three for the waterfall type) are controlled with the fill option but default values are provided. See example below.
figname or savefig or name : – figname=name.png
Save the figure with the figname=name.ext where ext chooses the figure image format.
A simple bar plot with 10 bars and automatic limits.
A bar group with selected colors and transparency.
A bar group with bars filled with patterns.
A bar group with error bars
A waterfall chart.
[Bar plots] examples.
The GMT man page