Skip to content

pole.gle

Library about polar plots and grids.

Copyright (c) 2020 Francois Tonneau

License: MIT


INTRODUCTION


This GLE library provides subroutines for plotting polar functions or polar

datasets read from a text file. Numeric values are plotted on a "wheel" which

may cover fewer than 360 degrees and may also be perforated at its center. The

colored background for plotting may coincide with the entire wheel or with

only an angular subset of it (the "fan"). The wheel can be decorated with

rays, rings, or threads pinned at regular angles (as in a spider web). The

wheel can also be annotated with angle values, arbitrary labels around the

outer wheel border, and tags along any ray of the wheel.

The labels around the wheel must be specified in a text file, either along the

data to be plotted or in a separated file. In all cases, the file must contain

on each line:

label angle count datum1 datum2 datum3 ...

where 'label' is the label for the current angle and where 'count' tells how

many data values appear on the remainder of the line. For example:

East 90 3 0.53 0.10 0.37

       ^-- angle   ^-- count   ^..................^.. data

An empty label should be replaced by two dashes. For example:

-- 90 3 0.53 0.10 0.37

Each line of a file used to specify labels instead of data must end with a

zero data count. For example:

North 0 0

East 90 0

^-- label ^-- angle


SUBROUTINE SUMMARY


wheelcenter x y # x, y coordinates in cm

wheeldims inner outer # inner, outer dimensions in cm

wheelvalues inner outer # [inner, outer] = numeric data range

startangles at going$ # 'going' = clockwise|counterclockwise

stopangles at

setfan from to # from, to: angles that limit clothing

resetfan # => fan coincides with whole wheel

fillcloth fill$

drawclothcontour

drawrings from to by no$ # write 'no last' to omit last value

drawsomerings p0$ p1$ p2$ p3$ p4$ p5$ p6$ p7$ p8$ p9$ # => up to 10 values

drawrays from to by no$ # write 'no last' to omit last value

drawsomerays p0$ p1$ p2$ p3$ p4$ p5$ p6$ p7$ p8$ p9$ # => up to 10 values

ticklength length

drawticks from to by no$ # write 'no last' to omit last value

drawsometicks p0$ p1$ p2$ p3$ p4$ p5$ p6$ p7$ p8$ p9$ # => up to 10 values

fillweb fill$ pin # 'pin': angle at which a web thread is pinned

drawthreads from to by pin # from, to, by: from inner to outer values

drawthreadaround pin # puts a pinned thread on the outer border

angleformat format$

writeangles from to by no$

writesomeangles p0$ p1$ p2$ p3$ p4$ p5$ p6$ p7$ p8$ p9$

labelstyle dist just$ # 'just' = basic|circular|radial|textual

writelabelsfrom filename$

tagstyle xoffset yoffset just$ format$ rotate$

writetags at from to by no$ # write 'no last' to omit last value

writesometags at p0$ p1$ p2$ p3$ p4$ p5$ p6$ p7$ p8$ p9$ # => up to 10 values

drawpolareq expr$ from to step color$ lwidth lstyle fill$

drawpolarline dataset$ color$ lwidth lstyle fill$ from to close$

drawpolarpoints dataset$ marker$ color$ msize lwidth from to

drawpolarimpulses number dataset$ color$ lwidth lstyle arrow$ from to

drawpolarerrors dataset$ errset$ pos$ color$ lwidth lstyle errwidth from to

drawpolarhist filename$ width color$ lwidth direction$

drawpolarmosaic filename$ expr$ width height color$ lwidth

xpp value angle # return x coordinate in cm

ypp value angle # return y coordinate in cm

movepp value angle # move to (value, angle) point

linepp value angle arrow$ # line to (value, angle) point


Private variables



Private subroutines


sub _pole_goto_center
sub _pole_cms value
sub _pole_degrees nominal_degrees
sub _pole_xpp value angle
sub _pole_ypp value angle
sub _pole_move value angle
sub _pole_line value angle arrow$
sub _pole_fix_last lastvalue delta no$
sub _pole_draw_ring value
sub _pole_draw_ray angle
sub _pole_draw_tick angle
sub _pole_draw_thread value angle pin
sub _pole_nudge_anchor string$ align$
sub _pole_degrees_0_360 unrestricted_degrees
sub _pole_upward_facing degrees
sub _pole_contour_write_basic degrees label$
sub _pole_contour_write_circular degrees label$
sub _pole_contour_write_radial degrees label$
sub _pole_contour_write_textual degrees label$
sub _pole_contour_write degrees label$
sub _pole_write_angle angle
sub _pole_write_tag angle value
sub _pole_draw_marker marker$ msize

Public subroutines


sub wheelcenter x y
sub wheeldims inner outer
sub wheelvalues inner outer
sub startangles at going$
sub stopangles at
sub setfan from to
sub resetfan
sub fillcloth fill$
sub drawclothcontour
sub drawrings from to by no$
sub drawsomerings p0$ p1$ p2$ p3$ p4$ p5$ p6$ p7$ p8$ p9$
sub drawrays from to by no$
sub drawsomerays p0$ p1$ p2$ p3$ p4$ p5$ p6$ p7$ p8$ p9$
sub ticklength length
sub drawticks from to by no$

sub drawsometicks p0$ p1$ p2$ p3$ p4$ p5$ p6$ p7$ p8$ p9$
Spiderweb drawing only supports full circles (from 0 to 360 degrees).

sub fillweb fill$ pin
sub drawthreads from to by pin
sub drawthreadaround pin
sub angleformat format$
sub writeangles from to by no$
sub writesomeangles p0$ p1$ p2$ p3$ p4$ p5$ p6$ p7$ p8$ p9$
sub labelstyle dist just$
sub writelabelsfrom filename$
sub tagstyle xoffset yoffset just$ format$ rotate$
sub writetags at from to by no$
sub writesometags at p0$ p1$ p2$ p3$ p4$ p5$ p6$ p7$ p8$ p9$
sub drawpolareq expr$ from to step color$ lwidth lstyle fill$
sub drawpolarline dataset$ color$ lwidth lstyle fill$ from to close$
sub drawpolarpoints dataset$ marker$ color$ msize lwidth from to
sub drawpolarimpulses number dataset$ color$ lwidth lstyle arrow$ from to
sub drawpolarerrors dataset$ errset$ pos$ color$ lwidth lstyle errwidth from to
sub drawpolarhist filename$ width color$ lwidth direction$
sub drawpolarmosaic filename$ expr$ width height color$ lwidth
sub xpp value angle
sub ypp value angle
sub movepp value angle
sub linepp value angle arrow$