sourcelibs/Plot/demos/weather.xtl
1⍝!/usr/bin/env xetal
2⍝# A year of weather in text charts: rainfall by month as bars,
3⍝# temperatures as a sparkline, a scatter of temperature against
4⍝# rain, and the temperatures as a line chart picture.
5⍝# Run with "just demo Plot weather".
6
7ᵖ⁼u̲se< "Plot"
8months ← "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"
9rain ← 102 86 79 52 41 18 5 9 22 61 95 118 ⍝ mm
10temp ← 8 9 12 15 19 23 27 27 23 17 11 8 ⍝ degrees C
11
12months ᵖb̲ars rain
13ᵖs̲park temp
14
15⍝ Warm months are dry: temperature (x) against rain (y).
16(36 10) ᵖs̲catter (2 12 r̲eshape temp c̲at rain)
17
18picture ← ᵖl̲ine! temp ⍝ shown as a picture
19
20⍝ Rain and temperature in one picture, titled, with named axes and a
21⍝ legend (the two series share the vertical axis).
22both ← ("A year of weather" "month" "mm, degrees C" "rain" "temperature") ᵖc̲hart! (e̲nclose rain) c̲at e̲nclose temp