# PSHISTOGRAM

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLES
BUGS
SEE ALSO

## NAME

| pshistogram − Bin data and plot histograms

## SYNOPSIS

pshistogram file −Jx|X parameters −W bin_width [ −A ] [ −B[p|s]parameters ] [ −C ] [ −E azimuth/elevation ] [ −G fill ] [ −H[i][nrec] ] [ −Jz|Z parameters ] [ −I[o|O] ] [ −K ] [ −L pen ] [ −O ] [ −P ] [ −Q ] [ −R xmin/xmax/ymin/ymax[r] ] [ −S ] [ −T col ] [ −U[/dx/dy/][label] ] [ −V ] [ −X[a|c|r][x-shift[u]] ] [ −Y[a|c|r][y-shift[u]] ] [ −Z type ] [ −c copies ] [ −bi[s|S|d|D][ncol] ] [ −f[i|o]colinfo ]

## DESCRIPTION

| pshistogram reads file [or standard input] and examines data column col to calculate histogram parameters based on the bin-width provided. Using these parameters, scaling, and optional range parameters it will generate PostScript code that plots a histogram. A cumulative histogram may also be specified.

| file |  | ASCII [or binary, see −b] datafile. If no file is given, pshistogram will read standard input.
| −Jx |  | xscale[/yscale] (Linear scale(s) in distance unit/data unit).
| −W |  | Sets the bin width used for histogram calculations.

## OPTIONS

| No space between the option flag and the associated arguments.

| −A |  | Plot the histogram horizontally from x = 0 [Default is vertically from y = 0].
| −B |  | Sets map boundary annotation and tickmark intervals; see the psbasemap man page for all the details.
| −C |  | Center bin on each value. [Default is left edge].
| −E |  | Sets the viewpoint’s azimuth and elevation (for perspective view) [180/90].

−G

Select filling of bars. [Default is no fill]. Specify the grey shade (0−255) or color (r/g/b, each in range 0−255; h-s-v, ranges 0−360, 0−1, 0−1; or c/m/y/k, each in range 0−100%; or valid color name). Alternatively, specify −Gp dpi/pattern, where pattern gives the number of the built-in pattern (1-90) or the name of a Sun 1-, 8-, or 24-bit raster file. The dpi sets the resolution of the image. For 1-bit rasters: use −GP for inverse video, or append :F color[B[color]] to specify fore- and background colors (use color = - for transparency). See GMT Cookbook & Technical Reference Appendix E for information on individual patterns.

| −H |  | Input file(s) has Header record(s). Number of header records can be changed by editing your .gmtdefaults4 file. If used, GMT default is 1 header record. Use −Hi if only input data should have header records [Default will write out header records if the input data have them].
| −I |  | Inquire about min/max x and y after binning. No plotting is done. Append o to output an ASCII table of the resulting x,y data to stdout. Alternatively, append O to output all x,y bin data even when y == 0.
| −K |  | More PostScript code will be appended later [Default terminates the plot system].

−L

Draw bar outline using the specified pen thickness. [Default is no outline]. pen is a comma delimetered list of width, color and texture, each of which is optional. width can be indicated as a measure (points, centimeters, inches) or as faint, thin[ner|nest], thick[er|est], fat[ter|test], or obese. color specifies a grey shade (0−255) or color (r/g/b, each in range 0−255; h-s-v, ranges 0−360, 0−1, 0−1; or c/m/y/k, each in range 0−100%; or valid color name). texture is a combination of dashes ‘-’ and dots ‘.’.

| −O |  | Selects Overlay plot mode [Default initializes a new plot system].
| −P |  | Selects Portrait plotting mode [GMT Default is Landscape, see gmtdefaults to change this].
| −Q |  | Draw a cumulative histogram.

−R

xmin, xmax, ymin, and ymax specify the Region of interest. For geographic regions, these limits correspond to west, east, south, and north and you may specify them in decimal degrees or in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left and upper right map coordinates are given instead of wesn. The two shorthands −Rg −Rd stand for global domain (0/360 or -180/+180 in longitude respectively, with -90/+90 in latitude). For calendar time coordinates you may either give relative time (relative to the selected TIME_EPOCH and in the selected TIME_UNIT; append t to −JX|x), or absolute time of the form [date]T[clock] (append T to −JX|x). At least one of date and clock must be present; the T is always required. The date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock string must be of the form hh:mm:ss[.xxx]. The use of delimiters and their type and positions must be as indicated (however, input/output and plotting formats are flexible). If not given, pshistogram will automatically find reasonable values for the region.

| −S |  | Draws a stairs-step diagram instead of histogram.
| −T |  | Specify which column to use for the histogram data. First column is 0 [0].
| −U |  | Draw Unix System time stamp on plot. User may specify where the lower left corner of the stamp should fall on the page relative to lower left corner of plot. Optionally, append a label, or c (which will plot the command string.). The GMT parameters UNIX_TIME and UNIX_TIME_POS can affect the appearance; see the gmtdefaults man page for details.
| −V |  | Selects verbose mode, which will send progress reports to stderr [Default runs "silently"].

−X −Y

Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, m, p). You can prepend a to shift the origin back to the original position after plotting, or prepend r [Default] to reset the current origin to the new location. If −O is used then the default (x-shift,y-shift) is (0,0), otherwise it is (r1i, r1i) or (r2.5c, r2.5c). Alternatively, give c to align the center coordinate (x or y) of the plot with the center of the page based on current page size.

| −Z |  | Choose between 6 types of histograms: 0 = counts [Default], 1 = frequency_percent, 2 = log (1.0 + count), 3 = log (1.0 + frequency_percent), 4 = log10 (1.0 + count), 5 = log10 (1.0 + frequency_percent).
| −c |  | Specifies the number of plot copies. [Default is 1].
| −bi |  | Selects binary input. Append s for single precision [Default is d (double)]. Uppercase S (or D) will force byte-swapping. Optionally, append ncol, the number of columns in your binary file if it exceeds the columns needed by the program. [Default is 2 input columns].

−f

Special formatting of input and output columns (time or geographical data). Specify i(nput) or o(utput) [Default is both input and output]. Give one or more columns (or column ranges) separated by commas. Append T (Absolute calendar time), t (time relative to chosen TIME_EPOCH), x (longitude), y (latitude), or f (floating point) to each column or column range item. Shorthand −f[i|o]g means −f[i|o]0x,1y (geographic coordinates).

## EXAMPLES

To draw a histogram of the data v3206.t containing seafloor depths, using a 250 meter bin width, center bars, and draw bar outline, use:

pshistogram v3206.t −JXh −W250 −C −L0.5p −V > plot.ps

If you know the distribution of your data, you may explicitly specify range and scales. E.g., to plot a histogram of the y-values (2nd column) in the file errors.xy using a 1 meter bin width, plot from -10 to +10 meters @ 0.75 cm/m, annotate every 2 m and 100 counts, and use black bars, run:

pshistogram errors.xy −W1 −R-10/10/0/0 −Jx0.75c/0.01c −B2:Error:/100:Counts: −Gblack −T1 −V > plot.ps

Since no y-range was specified, pshistogram will calculate ymax in even increments of 100.

## BUGS

| The −W option does not yet work properly with time series data (e.g., −f0T). Thus, such variable intervals as months and years are not calculated. Instead, specify your interval in the same units as the current setting of TIME_UNIT.

## SEE ALSO

| GMT(l), psbasemap(l), psrose(l), psxy(l)