grantmcdermott / grantmcdermott/tinyplot

Incompatible with arrays

Open
#548 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
427
Forks
25
Avg merge
22h 54m
Merged PRs (30d)
28

Description

Hi Grant!

I very much enjoyed using 'tinyplot', so thanks for creating it!
But there are a few small things I've noticed.

Entering arrays works for base plot, but produces an error for tinyplot:

> x <- 1:10
> y <- array(1:10, c(1, 10))
> plot(x, y)
> tinyplot::tinyplot(x, y)
Error in .axisPars(usr, log = log, nintLog = nint) : 
  non-finite axis extents [GEPretty(-inf,inf, n=5)]
In addition: Warning messages:
1: In min(x, na.rm = na.rm) :
  no non-missing arguments to min; returning Inf
2: In max(x, na.rm = na.rm) :
  no non-missing arguments to max; returning -Inf

Making those 2 arrays a 'broadcaster' (a simple class from the 'broadcast' package) still works for base plot, but produces a different error for tinyplot:

> broadcaster(x) <- broadcaster(y) <- TRUE
> plot(x, y)
> tinyplot::tinyplot(x, y)
Error in `[.default`(xj, i, , drop = FALSE) : subscript out of bounds

Is tinyplot incompatible with arrays? If so, perhaps this can be made more clear in the error message.

Kind regards,

Tony

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported array and broadcaster examples through tinyplot::tinyplot(x, y), comparing them with base plot(x, y). Trace the handling of array-like inputs and the resulting errors; done means the inputs work correctly or produce a clear, intentional compatibility error.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.