Reputation: 910
I want to save an image(..) on disk. I tried to save it like a plot as seen here. However, this does not work, as I only get a white file.
I'm plotting a matrix containing world values using image(). And than I overlay a world map from maptools. When I just plot those together it works fine, but not on the file. Sorry I don't really have a reproducible example as my data is too large, but here is the code I'm using:
library("maptools")
jpeg(file = "results/originmaps/ram_artichoke2.jpg")
x11()
par(mar=c(2,2,2,2))
image(lon,lat,artichoke_mat,col = grey(seq(1, 0, length = 256)))
data(wrld_simpl)
plot(wrld_simpl,add=TRUE)
dev.off()
Any ideas, what I'm doing wrong? or is there another way to save images? Thanks
Upvotes: 1
Views: 236
Reputation: 7469
Try without the call to x11()
:
library("maptools")
jpeg(file = "ram_artichoke2.jpg")
par(mar=c(2,2,2,2))
#image(lon,lat,artichoke_mat,col = grey(seq(1, 0, length = 256)))
data(wrld_simpl)
plot(wrld_simpl)
dev.off()
This worked for me but I did not have your data for lat
and lon
and artichoke_mat
to add in the data points of interest.
Upvotes: 1