I have trouble for plotting my raster and some points as sf object over that. I use aes(color=...)
to assign color to different types of my points. But I want to change the colours to specific ones like red and blue and yellow. also I can't use scale_fill_manual
because my raster layer's colours which is in first layer, shouldn't be changed. Is there any solution for this problem?
thanks in advance
geom_raster(data=dem2,aes(x=x,y=y,fill=elevation))
geom_sf(data=mypoint,aes(shape=Type,colour=ranges))
CodePudding user response:
The fill
parameter inside aes
wich you can manipulate manually using scale_fill_manual
works perfectly with polygons or raster data. But, when you need to color points
or simple lines, the color
parameter inside aes
is prefered. Said that, if you want to assing different colors to your points, use scale_color_manual
, this shouldnt interfer in your raster color.
CodePudding user response:
package "ggnewscale" will work in this problem. It allows to use different scale for color in one plot.