All Questions
23 questions
0
votes
1
answer
33
views
Plotting multiple customised rasters in a raster stack with colours already selected from viridis palette in R
Method
I'm working with satellite AQUA MODIS Lm3 files for chlorophyll-a, sea surface temperatures and sea surface salinity, and I calculated depth, slope and rugosity from GEBCO files using the terra ...
1
vote
0
answers
456
views
Making map with marginal graphics like rasterVis::levelplot(margin=T)
I love rasterVis::levelplot(margin=T) because its marginal graphics show the column (x)
and row (y) summaries of the Raster object. I think it is very helpful to visualize the raster.
Package ...
0
votes
0
answers
1k
views
Why is coord_sf needed to plot a geom_raster with ggplot2?
Why is coord_sf() needed to plot a geom_raster in ggplot2 and what exactly does coord_sf() do?
According to ggplot2's Map project's documentation: coord_map projects a portion of spherical earth onto ...
1
vote
0
answers
451
views
How to add polygon in ggplot2 with raster? Polygon is missing from final plot after ggplot
I have a stack of raster's and suppose to find the mean of it. I have done it. Now, I want to add polygon on the mean of raster image that I got. Then, from this raster I wants to save and make it ...
1
vote
1
answer
927
views
Limit the x-axis values of a barplot in r
I have a raster that includes the 120 million pixel values 0,1,10,11.
I generate a percentage raster. But I want the x-axis to show only the pixel values.
a = as.data.frame(diff_raster[[5]])
ggplot(a,...
0
votes
0
answers
213
views
Loop over dataframes and extract specific values to generate multiple rasters/plots
I would seek help to revise this script.
I need to generate multiple plots.
For example, the following code works well ggplot and gsave but I would prefer to use raster, and I tried something such as ...
5
votes
1
answer
3k
views
Plot two layers (raster and polygon-vector) with ggplot and use the fill-scale* for both layers
I am a little lost. I have a stars object where I would like to use the first attribute and map it to the
scale_fill*-function in ggplot.
I also have an polygon-object of class sf that has an ...
2
votes
1
answer
2k
views
Simplify raster size to plot using ggplot geom_raster()
I want to create a map using 'ggplot2'. My data contains shapefile (points data), polygons (European countries). Underneath the vector data, I wanted to place the raster showing extends of forests ...
0
votes
1
answer
932
views
geom_raster showing inverted colors
I am trying to plot a simple single band raster in R using ggplot. The only problem with my plot is that the colors are inverted. How can I fix that?
### For plotting I am using ggplot2 and ggpspatial ...
6
votes
1
answer
4k
views
Plotting multiple raster stacks with rasterVis::gplot and ggplot2::facet_wrap
I'm trying to ggplot2::facet_wrap a stack of rasters, and then call geom_raster to add more rasters on top of the previously mapped raster stack.
Here is a very simple example dataset to re-create ...
8
votes
1
answer
14k
views
Plotting a raster stack with ggplot2
My aim is to plot a rasterstack as a single image using ggplot2. First, I apply ggplot on a single layer raster using the following code:
#Load packages
library(raster)
library(ggplot2)
#Create a ...
1
vote
1
answer
2k
views
How to perform point to raster operation and plot it with raster of different spatial resolution in R?
I posted a question (please find the link below) regarding raster plots at stackoverflow but could not get the solution. Does anyone here has the solution?
https://stackoverflow.com/questions/63209707/...
1
vote
0
answers
327
views
R colored raster from QGIS to ggplot or tmap
I am fairly new in doing GIS work in R, but I thought this would be a nice situation to get my feet wet.
Here is the situation: I need to create multiple plots with the same background, the same ...
3
votes
1
answer
3k
views
Overlay shapefile on multiband raster using ggRGB and ggplot2 in R
I am trying to use ggplot2 to map a polygon feature class over a raster brick (created from multiple Landsat band images). I'm able to map the polygons and the raster separately, but when I try to ...
0
votes
2
answers
3k
views
raster::plot() plotting raster too small- is there an alternative on ggplot?
I am trying to plot this raster on R. The object is quite big, but when plotting it using the raster::plot() function, I obtain a very tiny image, as attached.
The code I use to produce it is the ...
3
votes
1
answer
1k
views
Convert all rasters in a rasterstack to polygons
I need to convert all rasters in a RasterStack to polygons and give the polygons names according to its respective raster.
library(raster)
## r is a single raster
rpolygon <- rasterToPolygons(r, ...
3
votes
2
answers
10k
views
How to plot gridded map from lat-lon and fill values in R?
I want to plot a spatial map in which each pixel is of 0.25 degree spatial resolution in R. For this I have fill values at 0.25 degree grid spacing.
Below is the data
-----------------------
...
2
votes
2
answers
2k
views
How to correctly plot SpatialPolygonDataFrames in ggplot and substract them in R
I have a landuse shapefile (contains data and script) that plots differently in Base and ggplot, the reason for which remains a myster after countless hours of playing with it.
I read in both ...
1
vote
1
answer
2k
views
Remove points outside a map with ggplot2
My dataset consist in a converted raster dataframe, with for each point a long/lat, a categorical value and a numerical value are associated with. It can be downloaded here.
The code hereafter ...
6
votes
2
answers
3k
views
Create a 3D topographic map with locations marked on the map using R
I am currently trying to create an interactive 3D surface plot using plotly in R. My dataset includes a matrix of Latitude and Longitude and I have a DEM for the region I would like to make this ...
1
vote
1
answer
2k
views
Save a rasterPCA plot as a raster file in R [closed]
Looking to the tutorial in http://bleutner.github.io/RStoolbox/rstbx-docu/rasterPCA.html, in which they show how to do a Principal Component Analysis on raster data, I was wandering whether is it ...
1
vote
1
answer
356
views
Tearing of SpatialLinesDataFrame and problem with gClip function
I am trying to use ggmap with geom_map and geom_path commands to add a SpatialPolygonsDataFrame of African countries and a SpatialLinesDataFrame over a raster. When I use the defined function gClip() ...
4
votes
1
answer
607
views
Projection mismatch when plotting precipitation with ggplot
I'm trying to plot accumulated precipitation in Brazil for a given period, see code below:
Load packages
library(raincpc)
library(SDMTools)
library(raster)
library(ggplot2)
library(rgdal)
library(...