{"id":8356,"date":"2019-01-03T23:28:04","date_gmt":"2019-01-03T21:28:04","guid":{"rendered":"https:\/\/www.datanovia.com\/en\/?p=8356"},"modified":"2019-12-25T11:08:21","modified_gmt":"2019-12-25T09:08:21","slug":"how-to-create-a-map-using-ggplot2","status":"publish","type":"post","link":"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/","title":{"rendered":"How to Create a Map using GGPlot2"},"content":{"rendered":"<div id=\"rdoc\">\n<p>This article provide many examples for creating a <strong>ggplot map<\/strong>. You will also learn how to create a <strong>choropleth map<\/strong>, in which areas are patterned in proportion to a given variable values being displayed on the map, such as population life expectancy or density.<\/p>\n<p>Contents:<\/p>\n<div id=\"TOC\">\n<ul>\n<li><a href=\"#prerequisites\">Prerequisites<\/a><\/li>\n<li><a href=\"#create-a-simple-map\">Create a simple map<\/a>\n<ul>\n<li><a href=\"#world-map\">World map<\/a><\/li>\n<li><a href=\"#map-for-specific-regions\">Map for specific regions<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#make-a-choropleth-map\">Make a choropleth Map<\/a>\n<ul>\n<li><a href=\"#world-map-colored-by-life-expectancy\">World map colored by life expectancy<\/a><\/li>\n<li><a href=\"#us-map-colored-by-violent-crime-rates\">US map colored by violent crime rates<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/div>\n<div class='dt-sc-hr-invisible-medium  '><\/div>\n<div class='dt-sc-ico-content type1'><div class='custom-icon' ><a href='https:\/\/www.datanovia.com\/en\/product\/ggplot2-essentials-for-great-data-visualization-in-r\/' target='_blank'><span class='fa fa-book'><\/span><\/a><\/div><h4><a href='https:\/\/www.datanovia.com\/en\/product\/ggplot2-essentials-for-great-data-visualization-in-r\/' target='_blank'> Related Book <\/a><\/h4>GGPlot2 Essentials for Great Data Visualization in R<\/div>\n<div class='dt-sc-hr-invisible-medium  '><\/div>\n<div id=\"prerequisites\" class=\"section level2\">\n<h2>Prerequisites<\/h2>\n<p>Key R functions and packages:<\/p>\n<ul>\n<li><strong>map_data<\/strong>() [in ggplot2] to retrieve the map data. Require the <code>maps<\/code> package.<\/li>\n<li><strong>geom_polygon<\/strong>() [in ggplot2] to create the map<\/li>\n<\/ul>\n<p>We\u2019ll use the viridis package to set the color palette of the choropleth map.<\/p>\n<p>Load required packages and set default theme:<\/p>\n<pre class=\"r\"><code>library(ggplot2)\r\nlibrary(dplyr)\r\nrequire(maps)\r\nrequire(viridis)\r\ntheme_set(\r\n  theme_void()\r\n  )<\/code><\/pre>\n<\/div>\n<div id=\"create-a-simple-map\" class=\"section level2\">\n<h2>Create a simple map<\/h2>\n<div id=\"world-map\" class=\"section level3\">\n<h3>World map<\/h3>\n<p>Retrieve the world map data:<\/p>\n<pre class=\"r\"><code>world_map &lt;- map_data(\"world\")\r\nggplot(world_map, aes(x = long, y = lat, group = group)) +\r\n  geom_polygon(fill=\"lightgray\", colour = \"white\")<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/114-ggplot-map-world-map-1.png\" width=\"576\" \/><\/p>\n<\/div>\n<div id=\"map-for-specific-regions\" class=\"section level3\">\n<h3>Map for specific regions<\/h3>\n<ol style=\"list-style-type: decimal;\">\n<li>Retrieve map data for one or multiple specific regions:<\/li>\n<\/ol>\n<pre class=\"r\"><code># Some EU Contries\r\nsome.eu.countries &lt;- c(\r\n  \"Portugal\", \"Spain\", \"France\", \"Switzerland\", \"Germany\",\r\n  \"Austria\", \"Belgium\", \"UK\", \"Netherlands\",\r\n  \"Denmark\", \"Poland\", \"Italy\", \r\n  \"Croatia\", \"Slovenia\", \"Hungary\", \"Slovakia\",\r\n  \"Czech republic\"\r\n)\r\n# Retrievethe map data\r\nsome.eu.maps &lt;- map_data(\"world\", region = some.eu.countries)\r\n\r\n# Compute the centroid as the mean longitude and lattitude\r\n# Used as label coordinate for country's names\r\nregion.lab.data &lt;- some.eu.maps %&gt;%\r\n  group_by(region) %&gt;%\r\n  summarise(long = mean(long), lat = mean(lat))<\/code><\/pre>\n<ol style=\"list-style-type: decimal;\" start=\"2\">\n<li>Visualize<\/li>\n<\/ol>\n<pre class=\"r\"><code>ggplot(some.eu.maps, aes(x = long, y = lat)) +\r\n  geom_polygon(aes( group = group, fill = region))+\r\n  geom_text(aes(label = region), data = region.lab.data,  size = 3, hjust = 0.5)+\r\n  scale_fill_viridis_d()+\r\n  theme_void()+\r\n  theme(legend.position = \"none\")<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/114-ggplot-map-map-of-a-specific-region-1.png\" width=\"576\" \/><\/p>\n<\/div>\n<\/div>\n<div id=\"make-a-choropleth-map\" class=\"section level2\">\n<h2>Make a choropleth Map<\/h2>\n<div id=\"world-map-colored-by-life-expectancy\" class=\"section level3\">\n<h3>World map colored by life expectancy<\/h3>\n<p>Here, we\u2019ll create world map colored according to the value of life expectancy at birth in 2015. The data is retrieved from the WHO (World Health Organozation) data base using the <a href=\"https:\/\/cran.r-project.org\/web\/packages\/WHO\/vignettes\/who_vignette.html\">WHO R package<\/a>.<\/p>\n<ol style=\"list-style-type: decimal;\">\n<li>Retrieve life expectancy data and prepare the data:<\/li>\n<\/ol>\n<pre class=\"r\"><code>library(\"WHO\")\r\nlibrary(\"dplyr\")\r\nlife.exp &lt;- get_data(\"WHOSIS_000001\")             # Retrieve the data\r\nlife.exp &lt;- life.exp %&gt;%\r\n  filter(year == 2015 &amp; sex == \"Both sexes\") %&gt;%  # Keep data for 2015 and for both sex\r\n  select(country, value) %&gt;%                      # Select the two columns of interest\r\n  rename(region = country, lifeExp = value) %&gt;%   # Rename columns\r\n  # Replace \"United States of America\" by USA in the region column\r\n  mutate(\r\n    region = ifelse(region == \"United States of America\", \"USA\", region)\r\n    )                                     <\/code><\/pre>\n<ol style=\"list-style-type: decimal;\" start=\"2\">\n<li>Merge map and life expectancy data:<\/li>\n<\/ol>\n<pre class=\"r\"><code>world_map &lt;- map_data(\"world\")\r\nlife.exp.map &lt;- left_join(life.exp, world_map, by = \"region\")<\/code><\/pre>\n<ol style=\"list-style-type: decimal;\" start=\"3\">\n<li>Create the choropleth map. Note that, data are missing for some region in the map below:<\/li>\n<\/ol>\n<ul>\n<li>Use the function <code>geom_polygon()<\/code>:<\/li>\n<\/ul>\n<pre class=\"r\"><code>ggplot(life.exp.map, aes(long, lat, group = group))+\r\n  geom_polygon(aes(fill = lifeExp ), color = \"white\")+\r\n  scale_fill_viridis_c(option = \"C\")<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/114-ggplot-map-choropleth-map-life-expectancy-1.png\" width=\"480\" \/><\/p>\n<ul>\n<li>Or use the function <code>geom_map()<\/code>:<\/li>\n<\/ul>\n<pre class=\"r\"><code>ggplot(life.exp.map, aes(map_id = region, fill = lifeExp))+\r\n  geom_map(map = life.exp.map,  color = \"white\")+\r\n  expand_limits(x = life.exp.map$long, y = life.exp.map$lat)+\r\n  scale_fill_viridis_c(option = \"C\")<\/code><\/pre>\n<\/div>\n<div id=\"us-map-colored-by-violent-crime-rates\" class=\"section level3\">\n<h3>US map colored by violent crime rates<\/h3>\n<p>Demo data set: <code>USArrests<\/code> (Violent Crime Rates by US State, in 1973).<\/p>\n<pre class=\"r\"><code># Prepare the USArrests data\r\nlibrary(dplyr)\r\narrests &lt;- USArrests \r\narrests$region &lt;- tolower(rownames(USArrests))\r\nhead(arrests)<\/code><\/pre>\n<pre><code>##            Murder Assault UrbanPop Rape     region\r\n## Alabama      13.2     236       58 21.2    alabama\r\n## Alaska       10.0     263       48 44.5     alaska\r\n## Arizona       8.1     294       80 31.0    arizona\r\n## Arkansas      8.8     190       50 19.5   arkansas\r\n## California    9.0     276       91 40.6 california\r\n## Colorado      7.9     204       78 38.7   colorado<\/code><\/pre>\n<pre class=\"r\"><code># Retrieve the states map data and merge with crime data\r\nstates_map &lt;- map_data(\"state\")\r\narrests_map &lt;- left_join(states_map, arrests, by = \"region\")\r\n\r\n# Create the map\r\nggplot(arrests_map, aes(long, lat, group = group))+\r\n  geom_polygon(aes(fill = Assault), color = \"white\")+\r\n  scale_fill_viridis_c(option = \"C\")<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/114-ggplot-map-choropleth-map-color-1.png\" width=\"576\" \/><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!--end rdoc--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article provide many examples for creating a ggplot map. You will also learn how to create a choropleth map, in which areas are patterned in proportion to a given [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7929,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rating_form_position":"","rating_results_position":"","mr_structured_data_type":"","footnotes":""},"categories":[124],"tags":[131],"class_list":["post-8356","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ggplot2","tag-ggplot2-faq"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Create a Map using GGPlot2: The Best Reference - Datanovia<\/title>\n<meta name=\"description\" content=\"This article provide many examples for creating a ggplot map. You will also learn how to create a choropleth map, in which areas are patterned in proportion to a given variable values being displayed on the map, such as population life expectancy or density.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create a Map using GGPlot2: The Best Reference - Datanovia\" \/>\n<meta property=\"og:description\" content=\"This article provide many examples for creating a ggplot map. You will also learn how to create a choropleth map, in which areas are patterned in proportion to a given variable values being displayed on the map, such as population life expectancy or density.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/\" \/>\n<meta property=\"og:site_name\" content=\"Datanovia\" \/>\n<meta property=\"article:published_time\" content=\"2019-01-03T21:28:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-12-25T09:08:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/El_Classico.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Alboukadel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alboukadel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/\"},\"author\":{\"name\":\"Alboukadel\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e\"},\"headline\":\"How to Create a Map using GGPlot2\",\"datePublished\":\"2019-01-03T21:28:04+00:00\",\"dateModified\":\"2019-12-25T09:08:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/\"},\"wordCount\":295,\"commentCount\":7,\"publisher\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/El_Classico.jpg\",\"keywords\":[\"ggplot2 FAQ\"],\"articleSection\":[\"ggplot2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/\",\"name\":\"How to Create a Map using GGPlot2: The Best Reference - Datanovia\",\"isPartOf\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/El_Classico.jpg\",\"datePublished\":\"2019-01-03T21:28:04+00:00\",\"dateModified\":\"2019-12-25T09:08:21+00:00\",\"description\":\"This article provide many examples for creating a ggplot map. You will also learn how to create a choropleth map, in which areas are patterned in proportion to a given variable values being displayed on the map, such as population life expectancy or density.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#primaryimage\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/El_Classico.jpg\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/El_Classico.jpg\",\"width\":1024,\"height\":512},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.datanovia.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create a Map using GGPlot2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"name\":\"Datanovia\",\"description\":\"Data Mining and Statistics for Decision Support\",\"publisher\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.datanovia.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\",\"name\":\"Datanovia\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"width\":98,\"height\":99,\"caption\":\"Datanovia\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e\",\"name\":\"Alboukadel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g\",\"caption\":\"Alboukadel\"},\"url\":\"https:\/\/www.datanovia.com\/en\/blog\/author\/kassambara\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create a Map using GGPlot2: The Best Reference - Datanovia","description":"This article provide many examples for creating a ggplot map. You will also learn how to create a choropleth map, in which areas are patterned in proportion to a given variable values being displayed on the map, such as population life expectancy or density.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/","og_locale":"en_US","og_type":"article","og_title":"How to Create a Map using GGPlot2: The Best Reference - Datanovia","og_description":"This article provide many examples for creating a ggplot map. You will also learn how to create a choropleth map, in which areas are patterned in proportion to a given variable values being displayed on the map, such as population life expectancy or density.","og_url":"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/","og_site_name":"Datanovia","article_published_time":"2019-01-03T21:28:04+00:00","article_modified_time":"2019-12-25T09:08:21+00:00","og_image":[{"width":1024,"height":512,"url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/El_Classico.jpg","type":"image\/jpeg"}],"author":"Alboukadel","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Alboukadel","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#article","isPartOf":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/"},"author":{"name":"Alboukadel","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e"},"headline":"How to Create a Map using GGPlot2","datePublished":"2019-01-03T21:28:04+00:00","dateModified":"2019-12-25T09:08:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/"},"wordCount":295,"commentCount":7,"publisher":{"@id":"https:\/\/www.datanovia.com\/en\/#organization"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#primaryimage"},"thumbnailUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/El_Classico.jpg","keywords":["ggplot2 FAQ"],"articleSection":["ggplot2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/","url":"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/","name":"How to Create a Map using GGPlot2: The Best Reference - Datanovia","isPartOf":{"@id":"https:\/\/www.datanovia.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#primaryimage"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#primaryimage"},"thumbnailUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/El_Classico.jpg","datePublished":"2019-01-03T21:28:04+00:00","dateModified":"2019-12-25T09:08:21+00:00","description":"This article provide many examples for creating a ggplot map. You will also learn how to create a choropleth map, in which areas are patterned in proportion to a given variable values being displayed on the map, such as population life expectancy or density.","breadcrumb":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#primaryimage","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/El_Classico.jpg","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/El_Classico.jpg","width":1024,"height":512},{"@type":"BreadcrumbList","@id":"https:\/\/www.datanovia.com\/en\/blog\/how-to-create-a-map-using-ggplot2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.datanovia.com\/en\/"},{"@type":"ListItem","position":2,"name":"How to Create a Map using GGPlot2"}]},{"@type":"WebSite","@id":"https:\/\/www.datanovia.com\/en\/#website","url":"https:\/\/www.datanovia.com\/en\/","name":"Datanovia","description":"Data Mining and Statistics for Decision Support","publisher":{"@id":"https:\/\/www.datanovia.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.datanovia.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.datanovia.com\/en\/#organization","name":"Datanovia","url":"https:\/\/www.datanovia.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","width":98,"height":99,"caption":"Datanovia"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e","name":"Alboukadel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g","caption":"Alboukadel"},"url":"https:\/\/www.datanovia.com\/en\/blog\/author\/kassambara\/"}]}},"multi-rating":{"mr_rating_results":[]},"_links":{"self":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts\/8356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/comments?post=8356"}],"version-history":[{"count":1,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts\/8356\/revisions"}],"predecessor-version":[{"id":8357,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts\/8356\/revisions\/8357"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media\/7929"}],"wp:attachment":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media?parent=8356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/categories?post=8356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/tags?post=8356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}