---
name: "pshistogram"
section: "1"
platform: "linux"
package: "gmt-manpages"
version: "3.4-1"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/pshistogram"
---

# pshistogram(1)

Bin data and plot histograms

## NAME

pshistogram - Bin data and plot histograms

## SYNOPSIS

**pshistogram** *file* **-Jx***xscale\[/yscale\]* **-W***bin\_width* **\[ -2 \] \[ -A \] \[ -B***tickinfo* **\]** **\[ -C \] \[ -E***azimuth/elevation* **\] \[ -G***fill* **\] \[ -H\[***nrec***\] \] \[ -I\[o\] \]** **\[ -K \] \[ -L***pen* **\] \[ -O \] \[ -P \] \[ -Q \]** **\[ -R***west/east/south/north***\[r\] \] \[ -S \] \[ -U\[***/dx/dy/***\]\[***label***\] \] \[ -V \]** **\[ -X***x-shift* **\] \[ -Y***y-shift* **\] \[ -Z***type* **\] \[ -c***copies* **\]** **\[ -bi\[s\]\[***n***\] \]**

## DESCRIPTION

**pshistogram reads the first column from** *file* **\[or standard input\] and** **calculates 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.**

- **-B**

  **Sets map boundary tickmark intervals. See psbasemap for details.**

- **-2**

  **Read second rather than first column.**

- **-A**

  **Plot the histogram horizontally from x = 0 \[Default is vertically from y = 0\].**

- **-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 shade (0-255) or color (r/g/b), or** **-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.** *dpi* **sets the resolution of the image. For 1-bit rasters: use -GP** **for inverse video, or append :F***r/g/b***\[B\[***r/g/b***\]\] to** **specify fore- and background colors (use** *r/g/b* **= - 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 .gmtdefaults file. If used, GMT default is 1 header record.**

- **-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.**

- **-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\].**

- **-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**

  *west, east, south,* **and** *north* **specify the Region of interest. To specify boundaries** **in degrees and minutes \[and seconds\], use the dd:mm\[:ss\] format. Append r if lower left and upper right** **map coordinates are given instead of wesn.** **If not given, pshistogram will automatically find reasonable values for the region.**

- **-S**

  **Draws a stairs-step diagram instead of histogram.**

- **-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 origin of plot by (***x-shift,y-shift***).** **Prepend a for absolute coordinates;** **the default (r) will reset plot origin.**

- **-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 double\].** **Append** *n* **for the number of columns in the binary file(s).** **\[Default is 2 input columns\].**

## 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, try:**\

**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, try:**\

**cut -f2 errors.xy \| pshistogram -W1 -R-10/10/0/0 -Jx0.75c/0.01c** **-B2:Error:/100:Counts: -G0 -V \> plot.ps**\

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

## SEE ALSO

*gmt*(l), *psbasemap*(l), *psrose*(l), *psxy*(l)
