All Questions
404
questions
2
votes
1
answer
64
views
R and ggplot with st_crop: map cropping does not work as wanted
I am trying to plot only a part of the world map, limited by a square with limits lon (-30, 90) and lat (30, 82). When I try to crop the map with sf_crop, it does not return the desired square when ...
1
vote
1
answer
37
views
I would like to identify the primary administrative unit from the latitude and longitude coded in the dataset
I want to identify the primary administrative unit from the latitude and longitude coded in the dataset, and fill that administrative unit with red
What I tried:
library(rnaturalearth)
library(sf)
...
2
votes
1
answer
35
views
Rotating/angle of ggplot key_glpyh, custom legend key glyph
I am trying to emulate a plot style ive seen online, created by Chris Canipe (https://www.axios.com/2017/12/15/the-flow-of-goods-between-states-1513304375). Looking at trade flows, I've managed to ...
0
votes
1
answer
68
views
Removing white border plotting maps with geom_sf
I am attempting to remove the white borders around a facet plot that I created with geom_sf(). Previously I was using the now deprecated rgdal package and coord_cartesian(). I am trying to get a ...
3
votes
1
answer
73
views
Trying to create continent map for South America but geom_polygon produces zigzag fill
I try to do this ggplot:
library (sf)
library(dplyr)
library(ggplot2)
continents.f.xy <- st_zm(continents.f)
continents_map_SA <- continents.f.xy%>%
dplyr::bind_rows() %>% #bind the ...
1
vote
3
answers
68
views
Customize malaria atlas project autoplots
I am trying to plot some data from the Malaria Atlas Project. Therefore, I looked in the vignette and used an example for getting started:
if (!require("malariaAtlas")) install.packages(&...
0
votes
1
answer
99
views
Draw data ellipses at spatial locations
I have a data objects that contains a sample of measurements obtained for two air pollutants at a series of monitoring stations. I also have the spatial coordinates of these stations. For example:
...
0
votes
1
answer
69
views
Longitude and latitude data not generating correct polygons using maps/mapdata/ggplot2 packages
I am trying to draw a map for all province within Egypt using maps and ggplot2 package in R, but I did not find any sub-region (provinces) for Egypt available in the databases of these packages.
So, I ...
2
votes
1
answer
77
views
How to show both colors at a border using geom_sf?
I'm creating a map with two layers- a heatmap (geom_tile) with biome data and layering a map of the different regions on top. I've got a list countries in each region and I got R to display a map with ...
0
votes
1
answer
113
views
How do I get a country as a region? [closed]
I am trying to color a country map based on level of weather risk in each admin area. I believe this can best be done in R, though my knowledge of R is next to zero.
From this post cannot add labels ...
3
votes
2
answers
259
views
Fill Subdivisions of Chloropeth Map with multiple Colors
I want to create a plot of Germany, where each of its 16 Bundesländer (Subdivisons) is colored differently, depending on the fulfillment of a handful of criteria. At the bottom you find a ...
0
votes
3
answers
147
views
Import shapefile and join to coordinates to create spatial dataframe in R
Before maptools and rgdal were deprecated, I used this code to import a shapefile, centroids csv and commuting count data, to create a flow map using the code below (I removed the ggplot code for ...
1
vote
1
answer
42
views
plot map with divergent colors according to 1 variable, saturation by another, ggplot2 not working
I am working in R with a shapefile (a Large SpatialPoygonsDataFrame with 311 elements), the 1970 district map of India. I can plot a map in spplot by the value of a data column b_all (a district-...
2
votes
1
answer
105
views
ggplot map displaying inaccurate coordinate scale
I am trying to to plot a projected world map using ggplot. So far I have plotted said map, but the coordinate axis scale of the map is off by a factor of 10^5. I am unsure what interaction is causing ...
2
votes
2
answers
114
views
Replace plot points with polygons
I am trying to create a plot where instead of using points to represent data, I use the outline of administrative boundaries.
The below code illustrates where I am up to. Just a simple ordered scatter ...