[R-sig-Geo] importing raster with embedded colors

Benjamin Leutner benjamin.leutner at uni-wuerzburg.de
Tue Aug 30 10:54:38 CEST 2016


If you import it as RasterBrick or RasterStack it should give you three 
RGB layers
These can then be plotted as an RGB composite:

b <- brick("your.tif")

## with raster
raster::plotRGB(b)

## or, if you prefer working with ggplot
RStoolbox::ggRGB(b, r = 1, g = 2, b = 3)

Cheers,
Benjamin

On 30.08.2016 05:23, Pascal Title wrote:
> Hi all,
>
> I've downloaded a shaded relief map from www.naturalearthdata.com (link to
> specific raster:
> http://www.naturalearthdata.com/downloads/50m-cross-blend-hypso/50m-cross-blended-hypso-with-shaded-relief-and-water/
> ).
> This website provides rasters with built-in color schemes that look really
> good. But I don't see how to import these colors into R with the raster. If
> I read in the raster and plot, I get the default terrain color scheme.
> If I load this .tif in QGIS, the color scheme is automatically loaded along
> with it.
>
> Is it possible to use the color scheme in R?
>
> thanks!
> -Pascal
>


-- 
Benjamin Leutner M.Sc.
PhD candidate

Department of Remote Sensing
University of Wuerzburg
Campus Hubland Nord 86
97074 Wuerzburg, Germany

Tel: +49-(0)931-31 89594
Email: benjamin.leutner at uni-wuerzburg.de
Web: http://www.fernerkundung.uni-wuerzburg.de



More information about the R-sig-Geo mailing list