Skip to content

geom_vline() behavior when using coord_trans() with custom transformation #2340

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

Closed
guyabel opened this issue Nov 17, 2017 · 1 comment
Closed

Comments

@guyabel
Copy link

guyabel commented Nov 17, 2017

I am trying to use a log-modulus transformation in my plot...

library(tidyverse)
library(scales)

log_modulus_trans <- function() 
  trans_new(name = "log_modulus", 
            transform = function(x) sign(x) * log(abs(x) + 1), 
            inverse = function(x) sign(x) * ( exp(abs(x)) - 1 ))

# fake data
set.seed(1)
d <- data_frame(
  tt = rep(1:10, 3),
  cc = rep(LETTERS[1:3], each = 10),
  xx = c(rnorm(10, mean = 100, sd = 10), 
         rnorm(10, mean = 0, sd = 10),
         rnorm(10, mean = -100, sd = 10)))

ggplot(data = d, 
       mapping = aes(x = tt, y = xx, group = cc)) +
  geom_line() + 
  coord_trans(y = "log_modulus")

rplot01
When I tried to add a geom_vline() things got weird...
rplot

@has2k1
Copy link
Contributor

has2k1 commented Nov 17, 2017

Related to #2149.

@hadley hadley closed this as completed Nov 30, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants