2

I want to add an additional tick to my plot in ggplot2, and used Solution 2 as described in the post Annotate ggplot with an extra tick and label.

It worked fine for me, giving the following result in R Studio:

enter image description here

But when I try to save the result using ggsave() to create the a .pdf, .ps, or .png file, the red number is cut off half like this:

enter image description here

I have the feeling that the inner plot is printed first and later the margins are plotted on top of this.

Anybody has a hint?

Michael Harper
  • 14,721
  • 2
  • 60
  • 84
arnohakk
  • 53
  • 4
  • Did you try changing the `scale` and dimensions in ggsave? If not oculd you try? – amrrs Nov 16 '17 at 13:41
  • If you didn't specify the plot argument in `ggsave()`, try doing it explicitly. i.e. `ggsave(file name = "some.file.name", plot = grid.draw(g), ...)` – Z.Lin Nov 16 '17 at 13:51
  • Can you post your code for the plot? – cparmstrong Nov 16 '17 at 14:09
  • Thank you Z. Lin! I just had a `grid.draw(g)` instead of `g <- grid.draw(g)`. This dot in R always activates my python brain region :) – arnohakk Nov 18 '17 at 20:35

1 Answers1

1

Thank you Z. Lin! I just had a grid.draw(g) instead of g <- grid.draw(g). This dot in R always activates my python brain region :)

arnohakk
  • 53
  • 4