19 October 2018 | by Tim Ali

How to Make a Geographic Map in Q

Geographic map visualizations are a great way to show comparative values across countries, states, or regions. The geographic map shades the color of leach location in the map in proportion to data values. Here we’ll look at how to create a country level geographic visualization in Q.

Creating an input table

For a geographic map, your starting point should usually be a table of figures, with row labels that correspond to the locations you want to include in the map, and the remaining columns of the table containing the statistics to be shown in the map. In Q, there are a range of possibilities for creating such a table. I outline some of the main ones below.


A SUMMARY table, with a state or country question in the Blue drop-down menu, will allow you to map the number of people / proportion of people in each region from your sample.  An example of this table would look like this.

Alternatively, you could have a SUMMARY table of a Pick Any question or Number – Multi question, where there is one row (variable) for each geographic region that you want to include in your map. In this example, I have a question where the respondents have given ratings for several countries.

A crosstab

A crosstab, with a state or country question in the Blue drop-down menu, and another question in the Brown drop-down menu, would allow you to map a variety of different kinds of statistics. For example, if I wanted to chart ratings for satisfaction for respondents within each state, I could add a second question to my first example above.

Raw data table

In my example below, my data has one record per country. In this case another alternative to setting up the table is to simply create a raw data table using Create > Tables > Raw Data.


I have added a CSV file to my project which contains just two fields in this case: ‘Country’ and ‘Phone Lines’.  These are the only variables needed to create a country-level geographic chart. The geographic map charting function will automatically recognize the various country names and name variations. Those that cannot be recognized will be omitted from the chart.

I can use Create > Tables > Raw Data to create a raw data table containing all values in the data set without any aggregation. This create an object in the Report tree called raw.data. From the Object Inspector in the right pane, select ‘Country’ and ‘Phone Lines’  from the Variables drop-down list.

I click the  Calculate  button to generate the raw data table. Note that you can also tick the Automatic checkbox here to cause the raw data object to be refreshed when any changes are detected. The resulting table looks like this, with the raw data from the two variables listed next to one another.

Creating the geographic map

We can now feed the table above into the geographic map chart function. To do this, select Create > Charts > Visualization > Geographic Map. A chart object is created in the Report tree. From the Objector Inspector we can now enter the inputs for the geographic map.

Note that there are actually three different methods for providing input data to the map:

  1. Output – select a table from the Outputs tab. This is usually the best approach.
  2. Variables – select individual variables from your data set.
  3. Paste or type data – paste the data into spreadsheet input tool. This is a great approach when you have a set of numbers computed elsewhere and you just want to create a quick chart.

For this example, I select raw.data from the Output drop-down box to select the raw data object we created above. Click the Calculate button to generate the following geographic map.

geographic map

Note that many of the chart properties including the title, sub-title, color scheme, fonts, etc. can be modified under the Chart section of the Object Inspector. In the example above, I’ve modified a few of these properties including the title, footer, legend font size and color scheme. You can easily modify the different chart settings and recalculate the chart as needed. If you ticked the Automatic checkbox, the chart will be refreshed whenever changes have been made to any of the inputs or the chart properties.

Tips for getting the geography right

The geographic map visualization has an algorithm for matching the geographic labels to regions in several databases. If a label is misspelled or out-of-place, the algorithm may not be able to match it to the intended place. There are some tips that you can use to get your map successfully:

  • Don’t mix between states, continents, or countries. You must choose to create a map that shades one kind of region.
  • If using states, use states from a single country only. For example, don’t mix states of the US with states of Australia.
  • If you run into trouble trying to use states, try using the abbreviated state names.
  • Similarly, countries may be specified using names or ISO codes.

In addition to continents, countries, and states, the following kinds of other regions are also allowed:

Finally, there are two different mapping packages available to use, and they each have different maps available. You can change the setting by selecting the Charts section of the Objector Inspector, and going to the Map package option. The options are:

  • plotly – This option offers faster for more detailed maps. Only USA is available for state or region maps.
  • leaflet – This option offers continent maps, and a wide range of single-country state maps (including Australia).

We hope you found this article helpful! If you want discover how to do more in Q, book a personalized demo now!

Author: Tim Ali

No comment. Share your thoughts.

Leave a Reply

Your email address will not be published. Required fields are marked *