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

Give beeswarm plots fixed limits given input data #26

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

Conversation

jkrumbiegel
Copy link
Member

@jkrumbiegel jkrumbiegel commented Oct 3, 2024

Currently, whenever you call autolimits! on an axis with a beeswarm plot in it, you get a different result, because it takes the limits of the current scatter plot, but the algorithm finds a new result given those new limits.

I think it makes more sense to pick fixed limits and then adjust axis size or marker size if that's not enough space. You don't get "more" space for the beeswarm anyway by expanding limits, as the extent depends only on screen space.

This PR simply uses the heuristic that having the same space available for each swarm looks good, so it sets data limits that way. If swarms extend out of an Axis, that probably means that they also overlap each other in the middle anyway. So you're unlikely to get a better image by deviating from the heuristic.

Copy link
Member

@asinghvi17 asinghvi17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good! One small change - if there is a gutter then we already have the minimum separation, so that should be corrected.

src/recipe.jl Outdated Show resolved Hide resolved
Co-authored-by: Anshul Singhvi <[email protected]>
@jkrumbiegel
Copy link
Member Author

@asinghvi17 wouldn't it maybe be a bit more intuitive if gutter gave the column width instead of half of it? Because mostly you're going to use this with categories anyway where 1 would mean touching and 0.8 a little gap, etc.

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.

2 participants