2
votes
3answers
135 views

R - color SpatialLines by attribute

I have a SpatialLinesDataFrame dataset of rivers in R. The dataset consists of lines (river segments) with a "Turbidity" attribute. I want to create a map and legend, where: Turbidity between 0 and ...
5
votes
1answer
208 views

Legend of a raster map with categorical data

I would like to plot a raster containing 4 different values (1) with a categorical text legend describing the categories such as 2 but with colour boxes. I've tried using legend such as : legend( ...
9
votes
1answer
4k views

Raster legend in R: how to colour specific values?

I have an elevation model plotted in R r <- raster("example.dem") plot(r, col = topo.colors(20)) Some of the values are below sea level (0), and I'd like to have those display in red. How can ...