{"id":453,"date":"2019-02-13T19:53:54","date_gmt":"2019-02-13T19:53:54","guid":{"rendered":"http:\/\/miriamposner.com\/classes\/dh201w19\/?page_id=453"},"modified":"2019-02-13T19:54:31","modified_gmt":"2019-02-13T19:54:31","slug":"create-a-map-with-tableau","status":"publish","type":"page","link":"http:\/\/miriamposner.com\/classes\/dh201w19\/tutorials-guides\/mapping\/create-a-map-with-tableau\/","title":{"rendered":"Create a map with Tableau"},"content":{"rendered":"\n<p>Today, we&#8217;ll build an interactive, data-rich map with Tableau. As is the case with its data visualization capabilities, Tableau is a powerful tool, but its interface can be a bit confusing. In particular, it&#8217;s important to place measures and dimensions on the canvas in a particular order &#8212; trust me, I discovered this the hard way after clicking around fruitlessly for hours.<\/p>\n\n\n\n<p>We&#8217;ll be building a map that shows the home counties of people accused of witchcraft in Scotland in the late sixteenth through mid-eighteenth centuries. The source of the data is the wonderful&nbsp;<a href=\"http:\/\/witches.shca.ed.ac.uk\/\">Survey of Scottish Witchcraft Database<\/a>&nbsp;from the University of Edinburgh. Please download the CSV&nbsp;<a href=\"https:\/\/www.dropbox.com\/s\/p3xpsd7ubpmg6m5\/accused_witches.csv?dl=1\">here<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/make-a-map-with-tableau.md#open-tableau-and-connect-to-your-data\"><\/a>Open Tableau and connect to your data<\/h2>\n\n\n\n<p>As you did before, you&#8217;ll click on&nbsp;<strong>Connect to text file<\/strong>&nbsp;(<em>not<\/em>&nbsp;<strong>Connect to Excel file<\/strong>), because Tableau considers CSVs text files. Select the dataset you downloaded earlier.<\/p>\n\n\n\n<p>Once your data has loaded in, click on the orange&nbsp;<strong>Sheet 1<\/strong>&nbsp;button at the bottom of the Tableau window.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/images\/make-a-map-with-tableau\/open-tableau-and-connect-to-your-data.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/raw\/master\/images\/make-a-map-with-tableau\/open-tableau-and-connect-to-your-data.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/make-a-map-with-tableau.md#inspect-your-data\"><\/a>Inspect your data<\/h2>\n\n\n\n<p>As you&#8217;ll recall, Tableau divides your columns into&nbsp;<strong>dimensions<\/strong>&nbsp;and&nbsp;<strong>measures<\/strong>, and then further subdivides them into data types (like &#8220;text,&#8221; or &#8220;number&#8221;). Tableau has done a pretty good job, but there&#8217;s one field it didn&#8217;t recognize: in the&nbsp;<strong>Dimensions<\/strong>&nbsp;pane,&nbsp;<strong>Date<\/strong>&nbsp;should be classified as a date field, not a text field.<\/p>\n\n\n\n<p>To change it, click on the tiny&nbsp;<strong>Abc<\/strong>&nbsp;icon to the right of the word&nbsp;<strong>Date<\/strong>. From the drop-down menu, select (of course!)&nbsp;<strong>Date<\/strong>. The&nbsp;<strong>Abc<\/strong>&nbsp;icon will transform into a tiny calendar.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/images\/make-a-map-with-tableau\/inspect-your-data.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/raw\/master\/images\/make-a-map-with-tableau\/inspect-your-data.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/make-a-map-with-tableau.md#build-a-map\"><\/a>Build a map<\/h2>\n\n\n\n<p>For reasons that I confess aren&#8217;t entirely clear to me, it really matters in which order you add dimensions and measures to the canvas during this process. So follow along as closely as you can!<\/p>\n\n\n\n<p><strong>Double-click<\/strong>&nbsp;first&nbsp;<strong>Latitude<\/strong>&nbsp;and then&nbsp;<strong>Longitude<\/strong>. (Do&nbsp;<em>not use<\/em>&nbsp;<strong>Latitude (generated)<\/strong>&nbsp;or&nbsp;<strong>Longitude (generated)<\/strong>. We&#8217;ll talk about what these are in the next tutorial.)<\/p>\n\n\n\n<p>These field names will appear in the&nbsp;<strong>Rows<\/strong>&nbsp;and&nbsp;<strong>Columns<\/strong>&nbsp;panes, respectively. A map will appear on the canvas, containing a single data point. (Apparently the average of the longitude and latitude!)<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/images\/make-a-map-with-tableau\/build-a-map.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/raw\/master\/images\/make-a-map-with-tableau\/build-a-map.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/make-a-map-with-tableau.md#add-points-to-your-map\"><\/a>Add points to your map<\/h2>\n\n\n\n<p>Let&#8217;s create a map that shows a point for the home county of each person accused of witchcraft. To do this, drag the&nbsp;<strong>Accused ID<\/strong>&nbsp;dimension onto the&nbsp;<strong>Detail<\/strong>&nbsp;button within the&nbsp;<strong>Marks<\/strong>&nbsp;pane. (Got that? Drop the&nbsp;<strong>Accused ID<\/strong>&nbsp;onto the&nbsp;<strong>Detail<\/strong>button.)<\/p>\n\n\n\n<p>(Why the&nbsp;<strong>Accused ID<\/strong>&nbsp;dimension? It&#8217;s because each record has a unique Accused ID number, so Tableau will be sure to map each record.)<\/p>\n\n\n\n<p>Now, each record appears on your map! Not bad!<\/p>\n\n\n\n<p>This is probably a good time to mention that you can &#8220;grab&#8221; your map to move it around by clicking your mouse and holding down the&nbsp;<strong>Shift<\/strong>&nbsp;key.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/images\/make-a-map-with-tableau\/add-points-to-your-map.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/raw\/master\/images\/make-a-map-with-tableau\/add-points-to-your-map.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/make-a-map-with-tableau.md#scale-the-points\"><\/a>Scale the points<\/h2>\n\n\n\n<p>Perhaps you&#8217;d like the points to grow in size if multiple people originated from that location. For that you&#8217;ll need a measure. From the&nbsp;<strong>Measures<\/strong>&nbsp;pane, grab the&nbsp;<strong>Number of Records<\/strong>&nbsp;measure and drop it on the&nbsp;<strong>Size<\/strong>&nbsp;button within the&nbsp;<strong>Marks<\/strong>&nbsp;pane.<\/p>\n\n\n\n<p>(In reality, no location has that many records associated with it, so this isn&#8217;t hugely illuminating.)<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/images\/make-a-map-with-tableau\/scale-the-points.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/raw\/master\/images\/make-a-map-with-tableau\/scale-the-points.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/make-a-map-with-tableau.md#format-your-tooltip-1\"><\/a>Format your tooltip (1)<\/h2>\n\n\n\n<p>As you&#8217;ve navigated your map, you may have noticed that&nbsp;<strong>tooltips<\/strong>&nbsp;&#8212; little information boxes &#8212; appear as you hover over points. However, at the moment, the tooltips aren&#8217;t as informative as they might be, since they just include latitude, longitude, and an ID number.<\/p>\n\n\n\n<p>There are two steps to creating tooltips. First, for each field you&#8217;d like to appear in the tooltip, drag the name and drop it on the&nbsp;<strong>Tooltip<\/strong>&nbsp;button within the&nbsp;<strong>Marks<\/strong>&nbsp;pane.<\/p>\n\n\n\n<p>For example, if I want each person&#8217;s&nbsp;<strong>First Name<\/strong>&nbsp;to appear in the tooltip, I&#8217;ll drag that dimension over to the&nbsp;<strong>Tooltip<\/strong>&nbsp;button.<\/p>\n\n\n\n<p>Do the same for each field you&#8217;d like to see in the tooltip.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/images\/make-a-map-with-tableau\/format-your-tooltip--1-.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/raw\/master\/images\/make-a-map-with-tableau\/format-your-tooltip--1-.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/make-a-map-with-tableau.md#format-your-tooltip-2\"><\/a>Format your tooltip (2)<\/h2>\n\n\n\n<p>Now each of those fields appears in your tooltip when you hover over a point. However, you may want to neaten it up a bit. To do that, click on the&nbsp;<strong>Tooltip<\/strong>&nbsp;button.<\/p>\n\n\n\n<p>You can delete the fields you don&#8217;t want to appear, like latitude and longitude. You can also rearrange things as you like. If you accidentally delete something, click on the&nbsp;<strong>Insert<\/strong>&nbsp;button within the tooltip pop-up window to re-insert it. When you&#8217;re done, click&nbsp;<strong>OK<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/images\/make-a-map-with-tableau\/format-your-tooltip--2-.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/raw\/master\/images\/make-a-map-with-tableau\/format-your-tooltip--2-.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/make-a-map-with-tableau.md#group-points-by-color\"><\/a>Group points by color<\/h2>\n\n\n\n<p>If you have several categories in your data, you might use color to distinguish among them. Our records include data for&nbsp;<strong>Sex<\/strong>, so we can use color to easily see points for men versus women.<\/p>\n\n\n\n<p>To do that, drag the&nbsp;<strong>Sex<\/strong>&nbsp;dimension to the&nbsp;<strong>Color<\/strong>&nbsp;button within the **Marks **pane.<\/p>\n\n\n\n<p>If you then click on the&nbsp;<strong>Colors<\/strong>&nbsp;button, you&#8217;ll find that you can alter the colors Tableau uses by default.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/images\/make-a-map-with-tableau\/group-points-by-color.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/raw\/master\/images\/make-a-map-with-tableau\/group-points-by-color.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/make-a-map-with-tableau.md#filter-points-1\"><\/a>Filter points (1)<\/h2>\n\n\n\n<p>Sometimes it&#8217;s helpful to look at only some data, rather than all of it at once. This can be especially useful when you&#8217;re trying to explore a dataset. Let&#8217;s filter by date. There are several parts to this, mostly because of the way that Tableau treats dates.<\/p>\n\n\n\n<p>First, drag the&nbsp;<strong>Date<\/strong>&nbsp;dimension to the&nbsp;<strong>Filter<\/strong>&nbsp;pane.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/images\/make-a-map-with-tableau\/filter-points--1-.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/raw\/master\/images\/make-a-map-with-tableau\/filter-points--1-.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/make-a-map-with-tableau.md#filter-points-2\"><\/a>Filter points (2)<\/h2>\n\n\n\n<p>A popup window will ask you how you want to filter on dates. We want to use years, so select&nbsp;<strong>Years<\/strong>.<\/p>\n\n\n\n<p>In the next popup window, select&nbsp;<strong>All<\/strong>&nbsp;(to indicate that we want to use all the years in our filter) and press&nbsp;<strong>OK<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/images\/make-a-map-with-tableau\/filter-points--2-.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/raw\/master\/images\/make-a-map-with-tableau\/filter-points--2-.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/make-a-map-with-tableau.md#filter-points-3\"><\/a>Filter points (3)<\/h2>\n\n\n\n<p>In the&nbsp;<strong>Filters<\/strong>&nbsp;pane, you now have a&nbsp;<strong>YEAR(Date)<\/strong>&nbsp;dimension. Click on it to produce a drop-down menu. From that menu, select&nbsp;<strong>Continuous<\/strong>.<\/p>\n\n\n\n<p>Why continuous? As you&#8217;ll see in the next step, we want Tableau to treat dates not individually but as a flowing range of values.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/images\/make-a-map-with-tableau\/filter-points--3-.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/raw\/master\/images\/make-a-map-with-tableau\/filter-points--3-.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/make-a-map-with-tableau.md#filter-points-4\"><\/a>Filter points (4)<\/h2>\n\n\n\n<p>After you select&nbsp;<strong>Continuous,<\/strong>&nbsp;a popup box will allow you to use scrubbers to define a date range.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/images\/make-a-map-with-tableau\/filter-points--4-.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/raw\/master\/images\/make-a-map-with-tableau\/filter-points--4-.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/make-a-map-with-tableau.md#savepublish-your-map\"><\/a>Save\/publish your map<\/h2>\n\n\n\n<p>Now you can save and publish your map by clicking on&nbsp;<strong>File<\/strong>&nbsp;and then&nbsp;<strong>Save to Tableau Public.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/blob\/master\/images\/make-a-map-with-tableau\/save-publish-your-map.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tableau_maps_1\/raw\/master\/images\/make-a-map-with-tableau\/save-publish-your-map.png\" alt=\"\"\/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Today, we&#8217;ll build an interactive, data-rich map with Tableau. As is the case with its data visualization capabilities, Tableau is a powerful tool, but its interface can be a bit &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/miriamposner.com\/classes\/dh201w19\/tutorials-guides\/mapping\/create-a-map-with-tableau\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Create a map with Tableau&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":455,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_eb_attr":"","footnotes":""},"class_list":["post-453","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"http:\/\/miriamposner.com\/classes\/dh201w19\/wp-json\/wp\/v2\/pages\/453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/miriamposner.com\/classes\/dh201w19\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/miriamposner.com\/classes\/dh201w19\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/miriamposner.com\/classes\/dh201w19\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/miriamposner.com\/classes\/dh201w19\/wp-json\/wp\/v2\/comments?post=453"}],"version-history":[{"count":0,"href":"http:\/\/miriamposner.com\/classes\/dh201w19\/wp-json\/wp\/v2\/pages\/453\/revisions"}],"up":[{"embeddable":true,"href":"http:\/\/miriamposner.com\/classes\/dh201w19\/wp-json\/wp\/v2\/pages\/455"}],"wp:attachment":[{"href":"http:\/\/miriamposner.com\/classes\/dh201w19\/wp-json\/wp\/v2\/media?parent=453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}