ggsave and path on Mac

457 views
Skip to first unread message

John

unread,
Jan 24, 2009, 10:18:45 AM1/24/09
to ggplot2
I may be crazy, but I think the path parameter on ggsave doesn't work
on Mac.

# path
this.dir <- "/Volumes/user/Documents/R Stuff/SRT/"
# path without trailing slash
this.dir <- "/Volumes/user/Documents/R Stuff/SRT"
# ggsave with path, works on windows and doesn't work on Mac
version 1: ggsave(p, "fname.eps", path=this.dir)
# this works on both mac and windows
version 2: ggsave(p, paste(this.dir, "fname.eps", sep=""))

Version 1 using the path does not work on Mac but does work on Windows
(I move regularly between the two systems). It's not a practical
problem; I just use version 2. But I thought I'd note it. Just in
case I tried a version leaving off the trailing / but that didn't make
a difference. On mac, ggsave with just a file name saves the file
into the home directory.

By the way, I've found that using ".eps" gives me the best results
with Microsoft Word (at least on Windows). My second best had been to
use the copy metafile in the Windows environment and then paste into
word. But I had to screw around with sizes in Word and the result was
not always for the best. With ".eps" I can specify the size in ggsave
and this works when I insert the picture file into my word document.
In other words, I disagree with the advice given in section 8.3 of the
book.

-- John Goldin

hadley wickham

unread,
Jan 29, 2009, 10:58:24 AM1/29/09
to John, ggplot2
Hi John,

I'm surprised it works for you on windows - looking at the code it
seems like the path parameter is completely ignored! It will be fixed
in the next release.

Regards,

Hadley
--
http://had.co.nz/
Reply all
Reply to author
Forward
0 new messages