An R package for high level data visualization and mapping.

learn more… | top users | synonyms

2
votes
0answers
28 views

ggplot2 fills holes in polygons

I have a shapefile composed of polygons (sample here), many of which have holes in them. I cleaned the polygon layer in GRASS. After cleaning, QGIS's 'Check Geometry Validity' tool returned no errors. ...
3
votes
1answer
45 views

Chaotic geo image in R

I am working with qmap (R package ggmap) and when I enter the following code: qmap("Rotterdam", maptype = "terrain", zoom = 13) + geom_polygon(aes(x = long, y = lat, group = group, fill = ...
1
vote
0answers
27 views

Sub setting shape file to plot a region and addressing mismatch in ggplot & data

I am plotting India's district map with data (cases). First I read data for each district and district shape file. Later I merge the two on district. Using fortify data I get ggplot. I get a ...
1
vote
1answer
49 views

rgdal / ggmap : rotate map data and clip map

I'm trying to plot a map of Toronto with ward boundaries and geocoded data on events over years. But the layout is such that I end up with mostly wasted space in the map. To increase resolution for ...
2
votes
1answer
17 views

Retain “region” elements for when using fortify() on a SpatialLinesDataFrame

I'm layering multiple plots using ggplot2 to create a map of Alaska that combines school location and the major road network. I've learned that despite being labeled "major roads" there is wide ...
3
votes
2answers
149 views

Plot tilted map in R

I would like to plot a tilted map, similar to the image below. I would prefer to do this using ggplot2 but I'm glad if there is a solution using base R. Any ideas on how to do this? Here is a dataset ...
0
votes
2answers
114 views

Remove lines from inside a polygon (shapefile) in r

I have this code which prints the Galápagos Islands. But inside the islands, there are lines that I want to get rid off. How is this possible in R? library(rgdal) library(ggplot2) URL <- "https:/...
1
vote
1answer
62 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() ...
3
votes
1answer
94 views

Tearing of polygons using ggmap and readOGR

I'm trying to incorporate a shape file of US states with ggmap and keep getting "tearing" of my polygons. I tried changing group=id to group=group which helped, but didn't seem to resolve the ...
0
votes
1answer
322 views

How to create a continuous scale with distinct/custom color and value breaks with ggplot2 map

As stated in the title, I'm trying to create a continuous scale with distinct color and value breaks within the ggplot2 package in R. I'm using some dummy code to illustrate my problem: library(...
1
vote
1answer
209 views

Error when trying to plot legend for geom_point with ggplot2

Here's some mock code to go along with my problem: #read in libraries library(ggmap) library(sp) library(raster) library(ggplot2) #read in country shapefile, project, fortify for mapping with ...
1
vote
1answer
114 views

Map with ggplot2 and bubbles

I've tried to plot a map of magnitude earthquakes in Colombia with ggplot. After many efforts, I got it. But, I need to focus in specially area where the data of magnitudes is (4, 4.1, 4.2, 4.3, 4.4, ...
2
votes
1answer
142 views

Trouble adding proportional circles on top of symbolized polygon in ggplot2 map

Data: Zipped ea.ml1 shapefile can be found here, and the country outline can be downloaded here at the GADM site. I've been using the Ethiopia ESRI shapefile. Branch locations are here. Per the ...
1
vote
1answer
384 views

How to create custom discrete color scheme for polygon attributes in ggplot2?

Back again with more questions. :) Data: Zipped ea.ml1 shapefile can be found here, and the country outline can be downloaded here at the GADM site. I've been using the Ethiopia ESRI shapefile. As ...
1
vote
1answer
95 views

Error in converting SpatialPolygonsDataFrame to Data Frame, R Script in QGIS

I am trying to convert a SpatialPolygonsDataFrame layer to a DataFrame to create plots using ggplot2 in an R Script within QGIS. I've used spatial join to append averages of BioClim mean temperature ...
4
votes
1answer
124 views

Use “facet_wrap” in ggplot2 with QGIS?

I'm using QGIS 2.6.1 and R version 3.2.2. I'm struggling to get the syntax on a R Script for creating plots via QGIS processing to work. My understanding is that R syntax in QGIS Processing is ...
5
votes
1answer
348 views

R fortify causing polygons to tear

I'm am having some trouble plotting my spatial data using ggplot2. The map looks fine when plotted using spplot, so I'm assuming that the tearing occurs at the fortify stage. The code is as follows: ...
2
votes
0answers
51 views

About shp for ggmap in the R

I am a new in R and GIS, so I kindly ask you on advice. I had a shp which I want to plot on google map. The shpfile is here: http://www.filedropper.com/exercisestanddata First I do this: ogrInfo(...
2
votes
1answer
2k views

Why is my stacked area graph in ggplot2 returned as stacked lines? [closed]

im having a bit of a problem creating my stacked area chart in ggplot2 in R, for some reason it is returning as a stacked line; eg data: library(ggplot2) Sector <- rep(c("S01","S02","S03","S04","...
0
votes
1answer
73 views

How can i plot this piece of code with ggplot2? [closed]

I have these vectors of the lakes in New Guinea and the coastline and i want to plot it using ggplot2 exactly as it follows but with a more cool appearance. co<-coastline.shp nglakes<-lakes....
1
vote
1answer
90 views

Phantom artifacts after converting to Robinson projection

I'm using ggplot to create a map using the Robinson projection. Ultimately, I'll be plotting individual countries, but I need to provide continent boundaries as a background layer (since some ...
3
votes
1answer
314 views

ggmap: clip a map

I'm using ggmap to grab Washington DC and I have a shapefile that I downloaded from here: library(ggplot2) library(ggmap) library(maptools) dc = get_map(location = 'DC', zoom = 12) nhbds = ...
11
votes
2answers
454 views

Point overplotting on maps in R (e.g. with ggplot2) - how to push points to the side, mark original positions, combine close-by points …?

I've got a database containing languages, their longitudes and latitudes and a feature value (either category 1, category 2 or both - in the plot these are marked red, blue and green respectively). ...
0
votes
1answer
94 views

TopologyException error during fortify SpatialPolygonsDataFrame

I tried to reproduce a recent question on spatial data visualization using ggplot2 and received the following error message during fortify(world, region = "ISO3"): Error: TopologyException: Input ...
5
votes
1answer
418 views

Plotting data without geographical coordinates besides the main map in ggplot2

I am trying to plot some data as a bubble chart on the world map using ggplot2 package in R. I am able to proceed as follows. # Load necessay packages library(ggplot2) library(rworldmap) library(...
0
votes
1answer
205 views

ggplot2 plots polygons with wrong topologies

I'm trying to plot polygons in R using ggplot2. In GRASS, QGIS and normal R the map renders fine, but ggplot2 seems to have some kind of topological difficultes I can't explain. With normal R it looks ...
3
votes
1answer
769 views

Geographic Heatmaps with Concentric Circles by Distance

I'm looking to generate a geographic heatmap (using 'ggmap') that overlays some dimension (to start, housing prices) over the lat/lon near a city center. Then I want to create circles of equi-distant ...
5
votes
1answer
174 views

Plotting islands in ggplot2

I'm trying to plot bodies of water on my map and struggling with islands in ggplot2. I understand the right/left-hand rule for exterior/interior rings but there is still a problem going from island to ...
0
votes
1answer
211 views

R using fortify to project shapefile on google map gives wrong results

I have a shapefile that looks like this > str(FieldsMap) Formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots ..@ data :'data.frame': 3 obs. of 2 variables: .. ..$ id : ...
1
vote
0answers
68 views

How to solve coordinate differences between packages

I have two maps generated by two different methods. The first, I used maps package and the function map() and symbols(). On the other hand, I used the ggmap package with the ggmap() and geom_point() ...
2
votes
0answers
395 views

How to prevent cross-world lines in ggplot world map?

I'm having issues displaying 'great circles' paths and polygons in ggmap, an extension of ggplot2. Please enter the following code to replicate my issues: https://gist.github.com/Robinlovelace/...
2
votes
2answers
349 views

Is there a county-level maps dataset that includes independent cities in virginia?

and thank you in advance for your help. The following code shows the dataset I am working with: library(maps) CountyMapData <- map_data("county") head(CountyMapData) long lat group ...
7
votes
4answers
11k views

Converting osm file to shapefile (or data frame) in R

I was looking for a road shapefile for Australia today. I ended up going to Geofabrik. Open Street Map has data in .osm format. But they do not have one in .shp for Australia. If possible, I want to ...
4
votes
1answer
298 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(...
0
votes
1answer
281 views

ggmap fortify start and end jumble

I have a census tiger line file for counties available from the Census website. I am trying to display this file on a ggmap, but fortify seems to jumble the regions. I can't find anyone else who has ...
0
votes
0answers
289 views

Chloropeth Map in R, Data on map not represented as in listed in the file

Below is the code for creating the Chloropeth Maps, once created, the actual problem is that the heat intensity indicated by the map is not according to the dataset column called value mentioned in ...
1
vote
0answers
386 views

Trying to Create a Global Choropleth Population Density Map then add Biodiversity Level

I am trying, quite unsuccessfully, to create a global choropleth population density map for a specific 120 countries, using ggplot2. Once I have created this choropleth map, I want to add number of ...
9
votes
2answers
596 views

Help choosing most suitable bivariate choropleth mapping coloring scheme

I am trying to overlay a nominal variable (2 categories - rainfed vs irrigated) in a choropleth map over a numeric variable. In order to highlight the difference in pattern among the two categories,...
4
votes
2answers
879 views

How can I create a choropleth from the 2010 census ZCTA shapefile using R and ggplot2?

I have created state and county choropleths in R using ggplot2. The method I have used for this came from Winston Chang's "R Graphics Cookbook". For those choropleths the map was already represented ...
3
votes
1answer
315 views

plotting a SpatialPolygons object using lines() without lines connecting separate polygons

This is almost an extension of a question asked on stackoverflow (http://stackoverflow.com/questions/12196440/extract-feature-coordinates-from-spatialpolygons-and-other-sp-classes), so I'll use the ...
3
votes
2answers
560 views

How to use ggplot with Processing in QGIS 2.0?

I'm trying to use R scripts within QGIS thanks to Processing. There are some example scripts available and I achieved to plots different columns of the attribute table (with the plot built-in package)....
2
votes
2answers
412 views

Plotting a certain range in azimuthal projection using ggplot2

I would like to limit a map to a particular range of values (i.e. northern hemisphere) under an azimuthal or orthographic projection in ggplot2. When I set ylim, I receive an error message that ...
1
vote
1answer
799 views

Can't plot polygons with R and ggplot2

I am new to shapefiles so I maybe ask some stupid questions, sorry. I want to plot a map of my region, with colour filled polygons using R. I have downloaded municipal (lines) and province (polygons) ...
3
votes
0answers
867 views

Fortifying re-projected shapefile for ggplot2 in R

I have a shapefile of US county boundaries which I got from the NHGIS. I can load the file using the rgdal package and see information about it: library(rgdal) shp_1860 <- readOGR("shp", "...
6
votes
1answer
710 views

Loading a png image as a map with ggplot2/ggmap

I am trying to find a workaround for ggmap's missing support of world maps (i.e. you can't create any maps that show latitudes > 80┬░, due to idiosyncrasies in the mapproj package). To a limited extend ...
3
votes
1answer
2k views

Layer map plots on top of one another in R/ggplot2

I'm making a choropleth map in R/ggplot2. I have the colored part working just fine. This code p <- ggplot() + geom_map(data=c_1860, aes(map_id = GISJOIN, fill = AHL002), ...
4
votes
1answer
498 views

How to join data from NHGIS to make choropleth maps in R/ggplot2?

I have downloaded shapefiles of county/state boundaries and census data keyed to those shapefiles from the NHGIS. Both the shapefiles and the census data have a GISJOIN column to be used for merging ...
6
votes
1answer
1k views

Anyway to remove points outlying shape in ggplot2?

I am to map a plot of an area and then plot points over it (given by Easting and Northing). However, I found out that there are certain mistakes in the data entered for Easting and Northing resulting ...
5
votes
0answers
866 views

Using stat_density2d with coord_map in ggplot2

In my example I am plotting a shapefile for all England & Wales, however I'm interested in the greater London area. If I allow ggplot to simply default and display the entire shapefile then the ...
4
votes
1answer
1k views

How do I create a heatmap in ggplot?

I'm using R with ggplot2 to generate maps from shapefiles and from data in SQL Server. I'm trying to get to a stage where I can automate a large chunk of the mapping I do. So far this is working well ...