On Feb 28, 2014, at 8:22 AM, Ciara O'Hara wrote:
> Hi all,
> I am running the script below to produce a map. The problem I am having is
saving it as a postscript file. A postscript file is created, but it is blank. I
have also run this is linux (with different paths) and I get the same thing
(blank postscript file). Does anyone know how to do this?
> P.S. the 'There were 50 or more warnings (use warnings() to see the
first 50)' error doesn't seem to be making any difference to the map so
don't worry about that. The legend is not working either, but one thing at a
time.
> Thanks,Ciara
>> library(ncdf)> library(maps)> library(mapdata)>
library(maptools)> library(RColorBrewer)>
shapefile<-readShapeLines("C:\\Users\\sophysics\\Desktop\\IRL_adm\\IRL_adm1.shp")>
file<-open.ncdf("C:\\Users\\sophysics\\Desktop\\TempData\\average\\average_1961.nc")>
data<-get.var.ncdf(file,"var61")>
lat<-get.var.ncdf(file,"lat")>
lon<-get.var.ncdf(file,"lon")>
postscript("Average_1961.ps")>
map("worldHires","Ireland",col="purple",fill=FALSE,box=NULL)>
image(lon,lat,data,col=rev(brewer.pal(9,"RdBu")),xaxt="n",yaxt="n",ann=FALSE,box=NULL,xlab=NULL,ylab=NULL,asp=-1)>
plot(shapefile,add=TRUE,border=FALSE)There were 50 or more warnings (use
warnings() to see the first 50)> title(main="Average temperature
1961")> legend("bottom",legend=leg,title =
"Temp",col=rev(brewer.pal(9,"RdBu")))Error in
as.graphicsAnnot(legend) : object 'leg' not found> dev.off()null
device 1
> [[alternative HTML version deleted]]
You apparently find it difficult to read the Posting Guide and the error
message displayed on the console.
>
> ________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Following advice above would help greatly in your efforts at communicating.
--
David Winsemius
Alameda, CA, USA