2

I'm trying to plot an Sentinel2 Image in R. I want to use plotRGB to get a true color image. My script looks like that:

library(raster)
library(sp)
library(rgdal)
library(ggplot2)


r=raster("Part1.tif")
brick_r=brick(r)

plotRGB(brick_r, r=1, g=2, b=3, stretch="lin")

//The problem is that the plot always comes out black and white. Together with that warning messages:

Warning messages:
1: In .local(x, ...) : layer was changed to 1
2: In .local(x, ...) : layer was changed to 1
3: In .local(x, ...) : layer was changed to 1 

Wo knows how to solve this problem? I can't find a solution online.

Max
  • 45
  • 3

0 Answers0