I am using the function read.asciigrid
in order to read a swiss topography file in ascii grid format.
Unfortunately, the default plot color is red to yellow, but I would like it to be green to white via brown (as in terrain.colors(n)
). I have tried everthing: Set par(col=terrain.colors(n))
, even with n=length(myasciifile), which is an enormously high number, write "col=" in the read.ascii-function....
Has anyone experience with that function? Wheres does R set the default color for the plot? I could not find any information in the help/on the internet.
Here's my code: (unfortunately I cannot post my dataset, but it is available here: http://www.toposhop.admin.ch/de/shop/products/height/dhm25200_1)
The data looks schematically like this: NCOLS 6 NROWS 6 XLLCORNER 479900. YLLCORNER 61900. CELLSIZE 5000. NODATA_VALUE -9999. 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400 3500 3600
topo=read.asciigrid("DHM_5000.asc", as.image = TRUE,
plot.image =TRUE, proj4string = CRS("+proj=somerc
+lat_0=46.95240555555556
+lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel
+towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs"))
Thanks in advance!!!