qgis basics for journalists
Set a color range based on data
An effective way of analyzing data it to graduate the colors on a map based on a field's data. The technical name for this type of map is choropleth but it's often referred to as a heat map or data map. This kind of coloring is applied to individual layers in the Layer Properties panel.
Change the layer properties
Make sure the layer with the joined data is selected in the Layers panel, go to the Layer menu and select Properties. A new window will appear. Symbology should be selected by default.
Change the Render pulldown menu to Graduated.
- Graduated spreads the color from dark to light or light to dark.
Change the Column to TOTAL_HOUS.
- This is the data we're going to use but you could select any of the columns.
Change the Classes to 5.
- This sets the number of steps in the data. Five is a good starting point.
- Try fewer steps when possible. It makes the map easier to read.
- Seven classes should be your max. More steps may highlight important data but can make the rest of the map hard to read.
Change the Color ramp to blue.
- Color ramps are very important and we'll talk more about them below.
Set the Mode to Equal Interval.
- This describes how the data is broken down to create classes
- Modes also get their own section below.
Click the Classify button.
- This should create five symbols with ranges and labels
- You can double-click to edit them
Your Layer Properties should look something like this:
Click the Apply button. The map colors change and the classes are added to your layer.
QGIS includes five modes for breaking data into classes. The first four are good for statistical exploration, the fifth is better for readers. They are:
Equal Interval: Divides your data into equally spaced groups. For example, data with a top value of 10 could be divided into five classes of 0 to 2, 2.1 to 4, 4.1 to 6, 6.1 to 8 and 8.1 to 10.
Quantile: Uses an equation to divide values into equal-sized subsets. For example, if you have 15 records and five classes, each class will have 3 records.
Natural Breaks (Jenks): Designed to create a map that is an absolutely accurate representation of data’s spatial attributes. It arranges records into different classes based on their values. It tries minimize the differences within classes while simultaneously maximizing the difference between classes.
Standard Deviation: Illustrates how values deviate from the average. Low deviation indicates values are close to the average. High deviation indicates they are far away from the average.
Pretty Breaks: Breaks the values into classes that are easily understood by non-statisticians. Example classes could look like this: 14 to 100, 100 to 200, 200 to 300, 300 to 378.
Use all of them. They will help you explore your data and find trends and outliers. And don't be afraid to edit the classes directly. This can also lead to interesting and informative results.
Changes in Version 1.7: The Equal Interval mode does not work in QGIS 1.7 due to a bug. Some people have reported a workaround by right-clicking on the joined layer and selecting Save As. Saving the shp file with a specified coordinate system should fuse the data permanently and allow Equal Interval to work. However, this has failed on some occasions.
Poor color choices make many, many maps completely unreadable. Since we don't have time for a lesson in color theory, I'm going to show you a short cut.
Cynthia Brewer, a professor of geography at Penn State, developed a tool called ColorBrewer that creates map colors that are easy to read. I strongly recommend that you spend some time on the site to learn how it works. Make sure to click on the "Learn More..." links. She does a good job of explaining map colors. Here's an abbreviated look at the three types graduate colors used in maps.
- Sequential: Use with data that goes from low to high. Low numbers should be lighter and high numbers should be darker.
- Diverging: Use to emphasize the change from a critical mid-range value and extremes at both ends of the data range. The critical class is a light color and low and high extremes are dark colors with contrasting hues.
- Qualitative: Use to show differences between different categories of data. Do not use this for sequential data because they do not imply differences between legend classes. This is the hardest type for normal readers to understand so use sparingly.
QGIS has integrated ColorBewer into the Color ramp menu. Here's how to use it.
Click on the Color ramp menus and select New color ramp... from the menu.
In the Color Ramp Type pop-up box select ColorBrewer from the pulldown menu and click OK
This opens the ColorBrewer Ramp menu. The Scheme name has 35 presets to choose from. Select Oranges.
Change the Colors menu to match the number of classes you have and click OK.
QGIS will ask you to give the new ramp a name. I use is pretty simple naming convention for my color ramps and would name this "Oranges - 5." If I was using four colors it would be named "Oranges - 4"
Click Apply and the new colors will be reflected in the map. Once you have color ramps that are easy to use, stick with them. It makes it easier for you to spot interesting trends in your data.
Save your work.