R语言里编码正确,为什么就是不输出图片呢?

# Create the data for the chart.
H <- c(7,12,28,3,41)
M <- c("Mar","Apr","May","Jun","Jul")

# Give the chart file a name.
png(file = "barchart_months_revenue.png")

# Plot the bar chart.
barplot(H,names.arg = M,xlab = "Month",ylab = "Revenue",col = "blue",
main = "Revenue chart",border = "red")
比如以上代码没有错,但是就是输不出来图片,为什么?

慕工程0101907
浏览 888回答 1
1回答

缥缈止盈

图片已经输出了,只是保存在你的工作目录中,默认是“我的文档”,不是“我的图片”目录。你可以修改一下R软件的工作目录,或者指定文件保存的绝对路径png(file = "barchart_months_revenue.png"),再输出图片就可以方便找到。我已试过你的代码,图片已经输出了,只是保存在“我的文档”。如图:
打开App,查看更多内容
随时随地看视频慕课网APP