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

stamp_ doesn't produce sidebar as in examples #143

Open
mikemahoney218 opened this issue Aug 9, 2019 · 5 comments
Open

stamp_ doesn't produce sidebar as in examples #143

mikemahoney218 opened this issue Aug 9, 2019 · 5 comments

Comments

@mikemahoney218
Copy link

Brief description of the problem or desired feature.
Using stamp() and its variants don't produce the characteristic bar on the right hand side of the plot as in the examples. The examples also seem to reflect old behavior where theme_cowplot() would be set as the default theme.

To reproduce, run the code from the online examples:

p <- ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +
  geom_point(aes(color = factor(Petal.Width)))

stamp_bad(p + guides(color = "none"))

example

@mikemahoney218
Copy link
Author

mikemahoney218 commented Aug 9, 2019

For comparison, here's the expected behavior pulled from vignettes (though the change in theme is expected):

correct

@clauswilke
Copy link
Contributor

In some circumstances, the line gets clipped, but it is not clear to me when. I experienced the behavior you describe at some point and then I moved the line a little to the left and that fixed it (see example).

library(ggplot2)
library(cowplot)
#> 
#> ********************************************************
#> Note: As of version 1.0.0, cowplot does not change the
#>   default ggplot2 theme anymore. To recover the previous
#>   behavior, execute:
#>   theme_set(theme_cowplot())
#> ********************************************************

p <- ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +
  geom_point(aes(color = factor(Petal.Width)))

stamp_bad(p + guides(color = "none"))

Created on 2019-08-09 by the reprex package (v0.3.0)

Could you let me know what graphics device and operating system you're using? Also, as a workaround, you can just copy the stamp() code and modify line 35:

draw_line(c(.9999999999, .9999999999), c(0, 1), size = 0.2*size, color = color, alpha = alpha)

Instead of c(.9999999999, .9999999999), use c(0.99, 0.99) or even c(0.98, 0.98) and see if that fixes it.

@mikemahoney218
Copy link
Author

mikemahoney218 commented Aug 9, 2019

Windows 10; RStudio tells me it's the null device - how would I go about checking further than that? Thanks for the workaround, by the way!

@mikemahoney218
Copy link
Author

c(0.999, 0.999) seems to be the sweet spot to get the line on the edge in this example:

example

@clauswilke
Copy link
Contributor

Yeah, so different graphics devices seem to have different sensitivity to where they start clipping. It's frustrating. Maybe I'll make the position configurable.

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

2 participants