diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-09-18 08:11:24 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-09-18 08:25:54 -0400 |
| commit | 3c21d1e0f7535faa23fbb6fe0959675833d140b7 (patch) | |
| tree | eaf6029f95b12af7d289fb9b819cce5ab89d5245 /src/p.bqn | |
| parent | c3a4f00fde95d989256f7df68fac4d8cc21e5489 (diff) | |
Avoid NaN in •Plot when all x or y values are the same
Diffstat (limited to 'src/p.bqn')
| -rw-r--r-- | src/p.bqn | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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) {𝕎𝕩}¨ ⊢ |
