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

geoms should be aware of the plotting area #7

Closed
slowkow opened this issue Jan 7, 2016 · 1 comment
Closed

geoms should be aware of the plotting area #7

slowkow opened this issue Jan 7, 2016 · 1 comment

Comments

@slowkow
Copy link
Owner

slowkow commented Jan 7, 2016

Issue #3 brought my attention to the fact that the ggrepel geoms are currently unaware of the available plotting area created by previous layers.

Instead, the ggrepel geoms assume that the plotting area is defined by the data provided to them. They should instead get the dimensions of the plotting area elsewhere, i.e. from the plot objects. I don't know how to implement this right now.

@slowkow
Copy link
Owner Author

slowkow commented Jan 10, 2016

Here's an example of the problem. Ideally, the labels would be free to move within the bounds of the entire plotting area.

d <- subset(mtcars, wt > 3 & wt < 4)
ggplot() +
  geom_point(
    data = mtcars,
    aes(wt, mpg), color = 'red'
  ) +
  geom_text_repel(
    data = d,
    aes(wt, mpg, label = rownames(d)),
    max.iter = 1e4
  ) +
  theme_classic(base_size = 16)

image

@slowkow slowkow mentioned this issue Jan 10, 2016
slowkow added a commit that referenced this issue Jan 10, 2016
Previously, labels were restricted to the x and y ranges defined by their
respective data points.

Currently, labels will be placed in the entire plotting area, regardless of
the ranges of their data points.
@slowkow slowkow closed this as completed Jan 10, 2016
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

No branches or pull requests

1 participant