I have been trying to load and plot a few shapefile in R using
ggplot() and am facing an issue with a line vector shapefile. It seems that the
readOGR() command is importing the line vectors ordering the points of the lines in the x-axis order so that the plot does not correspond to its correct shape. The "curvy" part of the lines are plotted wrongly, especially those in the right-most part of the plot.
The first figure attached illustrates how that shapefile is, plotted in QGIS. The second the output by loading the
readOGR() and plotting it with
ggplot(). I do so by running
library(rgdal) library(ggplot2) areas <- readOGR('.', 'areas') ggplot(fortify(areas)) + geom_line(aes(long, lat, group = group))
Any thoughts on how to fix it? Here the source shapefile.