numtools

perform numerical operations on vectors and matrices in unix pipes
git clone git://src.adamsgaard.dk/numtools # fast
git clone https://src.adamsgaard.dk/numtools.git # slow
Log | Files | Refs | README | LICENSE Back to index

commit 28866edd3b5db9c04759e3ffa034d698ba2022fd
parent 73826473ebdf93c722546afd28b60b783ae38abf
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Thu, 25 Mar 2021 21:03:42 +0100

add histpdf

Diffstat:
MMakefile | 8+++++++-
Ahistpdf | 11+++++++++++
Ahistpdf.1 | 21+++++++++++++++++++++
3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile @@ -8,7 +8,13 @@ PREFIX = /usr/local MANPREFIX = ${PREFIX}/man DOCPREFIX = ${PREFIX}/share/doc/${NAME} -SCRIPTS = mean max min sum rangetest +SCRIPTS = \ + histpdf\ + max\ + mean\ + min\ + rangetest\ + sum MAN1 = ${SCRIPTS:=.1} DOC = \ diff --git a/histpdf b/histpdf @@ -0,0 +1,11 @@ +#!/bin/sh +f="$(mktemp)" +cat > "$f" +gnuplot -e "set term unknown;\ + plot '${f}' using 0:1;\ + set term pdf;\ + nbins=10;\ + binwidth=(GPVAL_DATA_Y_MAX - GPVAL_DATA_Y_MIN) / nbins;\ + bin(x,width)=width * floor(x / width);\ + plot '${f}' using (bin(\$1, binwidth)):(1.0) smooth freq with boxes title ''" +rm -f "$f" diff --git a/histpdf.1 b/histpdf.1 @@ -0,0 +1,21 @@ +.Dd $Mdocdate$ +.Dt HISTPDF 1 +.Os +.Sh NAME +.Nm histpdf +.Nd plots a histogram of values in the first column +.Sh SYNOPSIS +.Nm +.Sh DESCRIPTION +The +.Nm +outputs a PDF plot, so make sure to redirect the standard output to +another program or to a file. +.Sh SEE ALSO +.Xr gnuplot 1 , +.Xr max 1 , +.Xr mean 1 , +.Xr min 1 , +.Xr sum 1 +.Sh AUTHORS +.An Anders Damsgaard Aq Mt anders@adamsgaard.dk