When I save the plot created from ggplot2 to a pdf by either using RStudio export option or ggsave
command, the legend is messed up. Following compares the legend as created in RStudio (top) and the resulting pdf (bottom). How can I fix this?
Asked
Active
Viewed 293 times
2

umair durrani
- 5,597
- 8
- 45
- 85
-
1Could you provide a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)? For example if I plot `ggplot(iris, aes(x=Sepal.Length, y=Petal.Length, lty=Species)) + geom_line()` and Export in RStudio to PDF, the legend markers appear correctly. – mathematical.coffee Dec 23 '15 at 03:52
-
1What are you viewing the PDF in? It might help to `embedFonts()` on the PDF. – Gregor Thomas Dec 23 '15 at 04:41
-
Adobe reader displays the messed up legend – umair durrani Dec 23 '15 at 04:49
-
@mathematical.coffee Unfortunately I can't share the data. For other datasets as in your example, the prob. doesn't occur. – umair durrani Dec 23 '15 at 04:51
-
2Substitute random data with the same structure. – IRTFM Dec 23 '15 at 06:27