Skip to content

Allow infinite and NA values to be swarmed#20

Open
billdenney wants to merge 5 commits intoaroneklund:masterfrom
billdenney:allow-infinite
Open

Allow infinite and NA values to be swarmed#20
billdenney wants to merge 5 commits intoaroneklund:masterfrom
billdenney:allow-infinite

Conversation

@billdenney
Copy link

Fix #19
Related to eclarke/ggbeeswarm#87

This PR does two things (three if you count removing trailing whitespace):

  1. Consolidates the code from swarmx() and swarmy() into swarmboth()
  2. Uses the new, internal xToFinite() function to convert NA, -Inf, and Inf to finite values.

@billdenney billdenney changed the title Allow infinite Allow infinite and NA values to be swarmed May 23, 2023
@billdenney
Copy link
Author

I'm responding to the suggestion to add an argument like

beeswarm(..., allow_infinite = TRUE)

That seems like the best and a straightforward way to maintain backward compatibility. The question I'd like to consider before adding it is: Does the error at the time of transformation give the intended result for the user?

The way that this PR is implemented, it pushes the question of, "Can this be plotted?" to the plotting function. It makes the plot succeed or fail identically to if you had plotted the points without a beeswarm (meaning that beeswarm doesn't make a decision about what can be plotted). For my use cases, I would expect beeswarm to provide the jitter to the points without otherwise making decisions in the process.

My use cases aren't everyone's use cases, so if you disagree, I'll add the argument as you suggest without further push back.

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.

swarmx() and swarmy() fail with infinite inputs

1 participant