Analyze Data: Five Ways You Can Make Interactive Maps

[This article was first published on Plotly Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Plotly’s new map making tools let you tell stories about data as it relates to geography. This post shows five examples of how you can make and style choropleth, subplot, scatter, bubble, and line maps. We made these maps with our APIs for R and Python. In the future, we will also support maps from our web app. Let us know if you have suggestions or feedback. You can integrate your maps with dashboards, IPython Notebooks, Shiny, PowerPoint, reports, and databases. For users who want to securely share graphs and data within a team and make interactive dashboards, contact us about Plotly on-premise.





Bubble Maps




Bubble charts allow you to show the location of an event as well as a third and fourth variable indicated by size and color. This bubble map shows Ebola cases in Africa. The zoomed in portion shows Guinea, Sierra Leone, and Liberia, where we can see bubbles. The bubbles indicate the the number of cases of Ebola (size) and the month of the case (color). You can toggle the bubbles on and off by pressing the legend. To refer to countries and states, we use country codes published by the International Organization for Standardization.


Source: HDX‘ style=”max-width: 100%;width: 600px;” width=”600″ onerror=”this.onerror=null;this.src=’https://plot.ly/404.png’;”/>



Choropleth Maps




Choropleth maps use shades or patterns in proportion to the measurement of the statistical property you’re examining. Different color scales let you communicate your message based on the type of data you have. In this case, we’re examining global GDP. The sequential color scale lets us quickly scan the map to look for the darkest blue–visible in China and the US.





Source: CIA World Factbook‘ style=”max-width: 100%;width: 600px;” width=”600″ onerror=”this.onerror=null;this.src=’https://plot.ly/404.png’;”/>



Lines on Maps




Lines on maps let you overlay data showing movement or activity between regions. In this case, we’re showing American Airlines flights between cities. We can state that we would like to use latitude and longitude and, for example, “USA” as our scope, then Plotly draws the relevant point on the map. You can set the layout options shown below from our web app or from our APIs. That means developers can work with designers and non-developers. In this case we’re using the option for “Azimuthal equal area”. Head to our web app to try the other options.








Scatter Plots on Maps




Like a bubble chart that uses size, you can use color in a scatter chart to indicate a third variable. In this case, we’re adding a color scale to show the number of incoming flights to each US airport. We can customize the text shown when you hover your mouse: here it shows the latitude, longitude, airport name, location, and number of incoming flights. We can also control the geographic styles of our map by turning on and off the land, lakes, rivers, countries, and subunits in our plot.





Map Subplots and Small Multiples




Now for the grand finale. The chart below shows the number of new Walmart stores opened yearly from 1962 to 2006. We made this map with Python. If you toggle your mouse over a given year, it will zoom in.
Source: University of Minnesota‘ style=”max-width: 100%;width: 1000px;” width=”1000″ onerror=”this.onerror=null;this.src=’https://plot.ly/404.png’;”/>



To leave a comment for the author, please follow the link and comment on their blog: Plotly Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)