From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- pkg/plot/hgpline.x | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 pkg/plot/hgpline.x (limited to 'pkg/plot/hgpline.x') diff --git a/pkg/plot/hgpline.x b/pkg/plot/hgpline.x new file mode 100644 index 00000000..50b3d9a8 --- /dev/null +++ b/pkg/plot/hgpline.x @@ -0,0 +1,56 @@ +include + + +# Any other type defaults to a connected line. +define PLOT_TYPES "|line|lhist|bhist|" +define LINE 1 # Connected line +define LHIST 2 # Line histogram +define BHIST 3 # Box histogram + +procedure hgpline (gp, x, y, n, type) + +pointer gp #I GIO pointer +real x[ARB] #I X coordinates +real y[ARB] #I Y coordinates +int n #I Number of coordinates +char type[ARB] #I Plot type + +int i +real x1, x2, bottom +char line[5] + +int strdic() + +begin + # Draw lines. + switch (strdic (type, line, 5, PLOT_TYPES)) { + case LHIST: + x1 = (3 * x[1] - x[2]) / 2 + call gamove (gp, x1, y[1]) + do i = 1, n-1 { + x2 = (x[i] + x[i+1]) / 2 + call gadraw (gp, x2, y[i]) + call gadraw (gp, x2, y[i+1]) + x1 = x2 + } + x2 = (3 * x[n] - x[n-1]) / 2 + call gadraw (gp, x2, y[n]) + case BHIST: + call ggwind (gp, x1, x2, bottom, x1) + x1 = (3 * x[1] - x[2]) / 2 + call gamove (gp, x1, bottom) + call gadraw (gp, x1, y[1]) + do i = 1, n-1 { + x2 = (x[i] + x[i+1]) / 2 + call gadraw (gp, x2, y[i]) + call gadraw (gp, x2, bottom) + call gadraw (gp, x2, y[i+1]) + x1 = x2 + } + x2 = (3 * x[n] - x[n-1]) / 2 + call gadraw (gp, x2, y[n]) + call gadraw (gp, x2, bottom) + default: + call gpline (gp, x, y, n) + } +end -- cgit