2/2 Lecture Notes: Doing More with CartoDB
February 2, 2016
I. #NHData Finds
What cool data visualizations have you found?
- You #NHDatafinds.
- Let’s talk about the Iowa Caucus.
- How would you make a map like you see on Washingtonpost.com with CartoDB? For starters, you would need a shapefile of counties.
II. Common issues with Assignment 2
- Not embedding into blog correctly (review how embed codes work again.)
- Map of points: not filtering.
- Remember to choose “Dataviz Turned-In Assignments” category, not “Dataviz Assignments” or “Assignments.” That makes your assignments show up on the Student Work category page I use to grade.
- Otherwise, good job!
III. CartoDB discoveries?
- Here’s a fun thing to try with data that has times in one column.
IV. Instruction / Lab – How to merge data sets.
Please follow along from your own computer.
You can create a lot of interesting maps in CartoDB by overlaying data. For example, here’s a map I created that overlays a data set of wine consumption on top of another of beer consumption. These are really two maps, but they are layered on top of one another, as you can see from the layer pulldown.
But what if you want all of the information on wine and beer consumption to appear in the same infobox? And what if you want to also display data from a completely different data set, such as, for example, annual number of road deaths? For that, you have to merge data tables into a single table.
You could do this manually in Excel but it would be quite a manual process. CartoDB will do it for you as long as you have one geographically-oriented column in each data set whose contents are exactly the same (for example, country names or country codes), you can merge them in a snap.
On your own time, I encourage you to go through a tutorial on CartoDB.com about how to merge two data tables that are in Carto’s data library. Today we’re going to walk through how to merge two data sets into this single map:
I got this information from the World Health Organization, which as it turns out has a lot of really interesting data in CSV format. This map has data merged from the following two data sets:
In class, I will show you how I used sorting and filtering to create separate tables for alcohol and wine consumption which I merged into a single data set, then merged that again with data on road deaths.
During the rest of class, please work on Assignment 4, which is to create a CartoDB map with data you find and report on. You should publish the map that tells the story around your data the best, but I will be awarding the most points to assignments that incorporate as many of the following as possible as long as the choices are appropriate to the story:
- Data from more than one source, either in CartoDB’s library or from somewhere else.
- Data that is imported from outside of CartoDB’s library.
- Data that is filtered to hide extraneous information, either within CartoDB or before importing by using Excel.
- Layered data sets.
- Customized markers and visual effects (e.g. different icons chosen in CartoDB or uploaded).
- Customized infoboxes, especially if you modify the HTML or CSS.