Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed handling non-finite values in colorBin arg domain. #429

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

CreMindES
Copy link

After investigating the special snowflake error message: "Error in if (bins < 2) { : argument is of length zero", it turned out that colorBin does not check for non-finite values in its 'domain' argument.

@CreMindES
Copy link
Author

Apologies, after reviewing the contents of test-colors.R, I need additional information about the design choices of domain.

I can think of two common approaches:

  1. supply explicit bounds e.g. c(1,100)
  2. supply the whole vector and let the function find out its extent

Both of them has their pros and cons, and of course we always try to respect backward compability.
May I ask you to elaborate on the idea of domain in case of NULL or single number?

@jcheng5
Copy link
Member

jcheng5 commented May 23, 2017

Can you give an example of the case you're trying to fix?

@CreMindES
Copy link
Author

CreMindES commented May 24, 2017

The code below gives that not so nice error message, due to not handled NAs.

bw <- c("black", "white");
binpal <- colorBin( palette = bw, domain = c( NA, NA ), bins = 100, pretty = T, alpha = 0.5, na.color = "red" );
binpal(1);

Error in if (bins < 2) { : argument is of length zero

I've run into this scenario due to an error while dynamically calculating the domain ( min and max ).

@CLAassistant
Copy link

CLAassistant commented Oct 2, 2019

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Tamás G. Barna seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants