thibautjombart / adegenet

adegenet: a R package for the multivariate analysis of genetic markers
168 stars 64 forks source link

legend disappear when i export pdf #294

Open zxy1555847 opened 4 years ago

zxy1555847 commented 4 years ago

hello i had use "adegent" finished my analysis and it works good however,when i want to export my results figures in pdf,i find that the legend of the picture is disappear the fact is that :when it is “plots(rstudio)”,the legend is still there,when it is ”zoom(rstudio)“ or ”export (rstudio)”,the legend isn‘t in where it should be image image image and my code is as follows: library("adegenet") library("gtools") dapc.sites <- dapc(x, n.da=10, n.pca=12) scatter(dapc.sites, xax=1, yax=2, grp=dapc.sites$grp, col=seasun(length(levels(grp))), pch=20, bg="white", solid=.7, scree.da=TRUE, scree.pca=TRUE, posi.da="bottomright", posi.pca="bottomleft", bg.inset="white", ratio.da=.25, ratio.pca=.25, inset.da=0.02, inset.pca=0.02, inset.solid=.5, onedim.filled=TRUE, mstree=TRUE, lwd=1, lty=1, segcol="black", legend=TRUE, posi.leg="topright", cleg=1, txt.leg=levels(grp), cstar = 1, cellipse = 1.5, axesell = FALSE, label = levels(grp), clabel = 1, xlim = NULL, ylim = NULL, grid = FALSE, addaxes = TRUE, origin = c(0,0), include.origin = TRUE, sub = "", csub = 1, possub = "bottomleft", cgrid = 1, pixmap = NULL, contour = NULL, area = NULL, label.inds = NULL)

zkamvar commented 3 years ago

To get this to work, you have to use the pdf() function to export your plots in this pattern:

pdf('path/to/output.pdf', width = 7, height = 7, pointsize = 5, colormodel = "cmyk")

# ... code to produce plot

dev.off()