I am generating a chlorophyll map for lake. I want to fill the lake with blue colour where there is a very low chlorophyll concentration and light blue for NA values. I am using a code as given below
gplot(Chlorophyll_map_5) + geom_tile(aes(fill=value)) + scale_fill_gradient(low = 'blue', high = 'red', na.value='blue',name="Chl-a (ug/l)",limits=c(0,1000)) + coord_equal()+theme_bw()
Which gives me a plot like this for na.value='blue'
:
When I use na.value='transparent'
I got this image:
If I change the colour of the na.value it also changes the background. Is there a way to fill the lake with colour without changing the background?
The output of my data:`The output of my data:
Formal class 'RasterLayer' [package "raster"] with 12 slots
..@ file :Formal class '.RasterFile' [package "raster"] with 13 slots
.. .. ..@ name : chr "/private/var/folders/68/hm_5ts9x7psb6j3wnb91_bfr0000gn/T/RtmpZ3BLZD/raster/r_tmp_2017-07-18_133827_28365_34843.grd"
.. .. ..@ datanotation: chr "FLT8S"
.. .. ..@ byteorder : Named chr "little"
.. .. .. ..- attr(*, "names")= chr "value"
.. .. ..@ nodatavalue : num -1.7e+308
.. .. ..@ NAchanged : logi FALSE
.. .. ..@ nbands : int 1
.. .. ..@ bandorder : Named chr "BIL"
.. .. .. ..- attr(*, "names")= chr "value"
.. .. ..@ offset : int 0
.. .. ..@ toptobottom : logi TRUE
.. .. ..@ blockrows : int 0
.. .. ..@ blockcols : int 0
.. .. ..@ driver : chr "raster"
.. .. ..@ open : logi FALSE
..@ data :Formal class '.SingleLayerData' [package "raster"] with 13 slots
.. .. ..@ values : logi(0)
.. .. ..@ offset : num 0
.. .. ..@ gain : num 1
.. .. ..@ inmemory : logi FALSE
.. .. ..@ fromdisk : logi TRUE
.. .. ..@ isfactor : logi FALSE
.. .. ..@ attributes: list()
.. .. ..@ haveminmax: logi TRUE
.. .. ..@ min : num 0.00335
.. .. ..@ max : num 3870657
.. .. ..@ band : int 1
.. .. ..@ unit : chr ""
.. .. ..@ names : chr "layer"
..@ legend :Formal class '.RasterLegend' [package "raster"] with 5 slots
.. .. ..@ type : chr(0)
.. .. ..@ values : logi(0)
.. .. ..@ color : logi(0)
.. .. ..@ names : logi(0)
.. .. ..@ colortable: logi(0)
..@ title : chr(0)
..@ extent :Formal class 'Extent' [package "raster"] with 4 slots
.. .. ..@ xmin: num 35.8
.. .. ..@ xmax: num 36.7
.. .. ..@ ymin: num 2.4
.. .. ..@ ymax: num 4.65
..@ rotated : logi FALSE
..@ rotation:Formal class '.Rotation' [package "raster"] with 2 slots
.. .. ..@ geotrans: num(0)
.. .. ..@ transfun:function ()
..@ ncols : int 3240
..@ nrows : int 8321
..@ crs :Formal class 'CRS' [package "sp"] with 1 slot
.. .. ..@ projargs: chr "+proj=longlat +ellps=WGS84 +no_defs"
..@ history : list()
..@ z : list()