-
Notifications
You must be signed in to change notification settings - Fork 7
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
Exporting admixture maps to .png or .pdf #17
Comments
Closed
Hi @skannry, The reason this happens is to do with the default graphic device currently used by To avoid the issue there are two options:
|
Thanks Tom
…________________________________
From: Tom Jenkins ***@***.***>
Sent: Wednesday, May 15, 2024 4:13 AM
To: Tom-Jenkins/mapmixture ***@***.***>
Cc: Samantha Kannry ***@***.***>; Mention ***@***.***>
Subject: Re: [Tom-Jenkins/mapmixture] Exporting admixture maps to .png or .pdf (Issue #17)
Hi @skannry<https://github.com/skannry>,
The reason this happens is to do with the default graphic device currently used by ggsave(), which is the AGG library<https://github.com/ghaerr/agg-2.6> (through the ragg<https://ragg.r-lib.org/> package, as oppose to grDevices png() which uses the Cairo library<https://www.cairographics.org/>. See this post<https://www.andrewheiss.com/blog/2017/09/27/working-with-r-cairo-graphics-custom-fonts-and-ggplot/> for more detail.
To avoid the issue there are two options:
1. Export your plots using grDevices::png()
png("../grDevices_klamath.png", type = "cairo", units = "in", width = 8, height = 8, res = 600)
map3
dev.off()
1. Export your plots using ggsave() but specifically to use the Cairo library
ggsave(plot = map3, filename = "../ggsave_klamath.png", device = png, type = "cairo", units = "in", width = 8, height = 8, dpi = 600)
ggsave(plot = map3, filename = "../ggsave_klamath.pdf", device = cairo_pdf, units = "in", width = 8, height = 8)
—
Reply to this email directly, view it on GitHub<#17 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BIHXOJKOCS3TLRVO7RQYT33ZCM7L5AVCNFSM6AAAAABHMK5BDGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJSGIZTQMZZG4>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Tom,
I had a follow up question for you. I have been trying different functions to export the plots to a .png. When I tried ggsave, the pies end up with the black lines delineating the percentages of admixture extending beyond the pies (see attached). Or trying to save it through Rstudio as a .png, the pies end up a bit fuzzy in larger format (see attached). I am wondering what function you use to save the plots as they look much crisper on your github.
Thanks,
Samantha
The text was updated successfully, but these errors were encountered: