From 3c21d1e0f7535faa23fbb6fe0959675833d140b7 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sat, 18 Sep 2021 08:11:24 -0400 Subject: =?UTF-8?q?Avoid=20NaN=20in=20=E2=80=A2Plot=20when=20all=20x=20or?= =?UTF-8?q?=20y=20values=20are=20the=20same?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/p.bqn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/p.bqn b/src/p.bqn index 2c9972e4..a3fa568f 100644 --- a/src/p.bqn +++ b/src/p.bqn @@ -26,7 +26,8 @@ PairRec ← { Plot ← { xy ← 1e300 (⊣-⊸⌈⌊) ⍉> 𝕨 PairRec 𝕩 # organize and clip pts ← <∘∾˘ xy - win ← -˜`¨ bounds ← (⌊´≍⌈´)¨ pts # min and range; min and max + AB ← {e←(÷5e15)(⊣×⌈´)|𝕩⋄(⌊≍⌈)˝⌾(-⟜0‿e)𝕩} # ensure 0 < window size + win ← -˜`¨ bounds ← (AB ⌊´≍⌈´)¨ pts # min and range; min and max ar ← 1⍟((÷4)⊸>∨1.5⊸<) ÷˜´ 1⊑¨win # height÷width dim ← width (⊣≍×) ar Scale ← ({¬𝕏}⌾(1⊸⊑) {𝕩÷˜𝕨-˜⊢}´¨ win) {𝕎𝕩}¨ ⊢ -- cgit v1.2.3