I want to save the image of a plot as png-file; however it cuts off the axis-labels. So I tried leaving a greater margin by setting "omi" and "mar" but it does not seem to work. Adding more pixels does not work either. A smaller value for cex.lab would make the axis visible but unreadably small.
Probably the mistake is silly, yet I cannot figure it out...
png(filename = "CarTheftForeigners.png",
width = 1120, height = 646, units = "px", pointsize = 12,
bg = "white", res = NA, family = "", restoreConsole = TRUE,
type = c("windows", "cairo", "cairo-png")
)
plot(Table$Car.Theft,Table$Foreigners,
type="p", pch=20, col="red",
main="Correlation of the Rate of Car Theft and Rate of Foreigners", cex.main=2,
xlab="Rate of Car Thefts",
ylab="Rate of Foreigners", cex.lab=2,
par(omi=c(1,1,1,1)+0.1))
abline(reg=lm(Foreigners ~ Car.Theft, data=Table),col="blue")
dev.off()
No matter what values I add for omi or mar, I always get the error:
Fehler in plot.window(...) : ungültiger 'xlim' Wert
Which is German and means that the xlim-value is invalid.
Thank you for your help!
plot
was trying to match the value frompar(omi=c(1,1,1,1)+0.1)
to the first unmatched parameter value inplot.default
's list of arguments, which wasxlim
in this case. – IRTFM