Reputation: 9875
I want to save my histogram as below. When I run the following, the plot shows up in Rstudio:
hist_L4 <- hist(L_4,breaks=10,main='histo')
print(hist_L4)
When I try to save it like so, it just saves blank white images, which is not the same as the plots it printed in Rstudio.
hist_L4 <- hist(L_4,breaks=10,main='histo')
png(file=paste0('path/name_of_png' , '.png' ))
print(hist_L4)
dev.off()
Why is it that I am getting blank white plots? Thanks.
Upvotes: 1
Views: 427
Reputation: 927
#Maybe simply this way?:
hist_L4 <- hist(L_4,breaks=10,main='histo')
hist_L4
png(file=paste0('path/name_of_png' , '.png' ))
hist_L4
dev.off()
Upvotes: 2