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

Already on GitHub? Sign in to your account

Double coordinate transformations for geoms that draw with other geoms #2149

Open
has2k1 opened this Issue Jun 2, 2017 · 0 comments

Comments

Projects
None yet
2 participants
Contributor

has2k1 commented Jun 2, 2017

When a geom queries the coordinate range and uses the result to create data that is then plotted by another geom, there is potentially a double transformation. i.e. coord.range() yields results in coordinate space and if followed by coord.transform(), the data may get transformed two times. Affects coords that transform the limits in coord$setup_panel_params and also do transforms in coord$transform. This includes coord_trans and coord_sf.

Affected geoms include geom_abline, geom_hline and geom_hline.

reprex

library(ggplot2)

df <- data.frame(x=1:6, y=10^(1:6))
ggplot(df, aes(x, y)) +
  geom_point() +
  geom_vline(xintercept=3, color='red') +
  coord_trans(y='log10')

The red line (at x=3) should be top to bottom.

@karawoo karawoo added bug coord labels Jun 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment