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

Expand discrete axis according to tile size with geom_tile #1284

Open
concimuscb opened this issue Jan 15, 2025 · 3 comments
Open

Expand discrete axis according to tile size with geom_tile #1284

concimuscb opened this issue Jan 15, 2025 · 3 comments
Labels
Milestone

Comments

@concimuscb
Copy link

When trying to use geom_tile for categorical variables, AFAIK there is no way to make tiles bigger than the original size without overlapping.

Image

Ideally, the axis would respond to the tile size and adjust the spacing between the entries. Alternatively, there could be an option in scale_*_discrete to control spacing between the categories.

This enables the creation of charts with bigger tiles without them overlapping like below:

Image

@alshan
Copy link
Collaborator

alshan commented Jan 15, 2025

If you wish to see lager tiles you can just add + ggsize(w,h) to make the plot and tiles larger without tile overlapping.
Also, tiles are square because by default geom_tile applies coord_fixed. You can override this default however by adding + coord_cartesian() to the plot.

@concimuscb
Copy link
Author

coord_cartesian() did the trick. Any reason why that is not the default?

A square is a particular case of a rectangle, so it feels a bit odd that the library defaults to the particular case instead of keeping it general.

@alshan
Copy link
Collaborator

alshan commented Jan 16, 2025

That sounds reasonable. I guess we implemented fixed coordinates as a default for tile geometry with geom_bin2d in mind, but for tiles in general it seems like overreach.

@alshan alshan added the * label Jan 16, 2025
@alshan alshan added this to the 2025Q1 milestone Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants