[英]how to save R pie chart on disc as .jpg?
Example of pie chart: 饼图示例:
slices <- c(10, 12, 4, 16, 8)
lbls <- c("US", "UK", "Australia", "Germany", "France")
pct <- round(slices/sum(slices)*100)
lbls <- paste(lbls, pct) # add percents to labels
lbls <- paste(lbls,"%",sep="") # ad % to labels
pie(slices,labels = lbls, col=rainbow(length(lbls)),main="Pie Chart of Countries")
jpeg(filename="Pie chart.jpg",width=480,height=480)
plot()
dev.off()
Above code creates blank .jpg. 上面的代码创建空白.jpg。 What arguments should I write in plot()...if that is correct.
如果正确,我应该在plot()中写哪些参数。
put the pie(...) line where plot() is now 将pie(...)行放在plot()现在的位置
jpeg(filename="Pie chart.jpg",width=480,height=480)
pie(slices,labels = lbls, col=rainbow(length(lbls)),main="Pie Chart of Countries")
dev.off()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.