QGIS Diagrams – Pie Charts for Symbols!
QGIS has a great feature that allows you to create pie charts for feature symbols! I have known about it for a while, but never really had the opportunity or reason to play with it. However, this post on gis.stackexchange.com prompted me to take a look. Here’s a quick summary of how the ‘Diagrams’ functionality works in case you’re like me and haven’t had time to check it out! It’s easy to do, and works pretty well!
As an example, I created a random sample dataset with some fictitious data. It contained three points, and the attribute table looked like this:
To create a diagram symbol, go to the properties for the layer in question, and click the “Diagrams” tab at the top, then check off “Display Diagrams” and set Diagram type to “Pie Chart.” You can also use “Text Diagram” but that’s another post!
You can set either a fixed size, or scale the size of the charts to an attribute value range. This is useful if you are wanting to use the size of the symbol to indicate a value, and the ‘slices’ to indicate percentages. In my case, I set the size to ’23′ and set it to scale between 0 and 30mm. This is arbitrary in my case, but you can play with it using your own data to see what works best for you.
At the bottom under “Attributes,” select each attribute you want to form a ‘slice’ of the pie, and click the ‘+’ on the right. Then select the next value, and click ‘+.’ Repeat until you are finished adding all values. In my case, I added attributes A, B, C, and D. I didn’t want to use the ID, so I left it out. You can set individual colours for each ‘slice’ here by double clicking the colour in the table. Here’s what my settings looked like:
and here’s here what the final product looks like:
This is already a great tool, and with a few more enhancements, it will be a fantastic tool! What enhancements you wonder? A couple that immediately come to mind are the ability to label ‘slices’ with either their attribute value, or their percentage, and the ability to remove all borders (in the above example, ‘Pen Width’ is set to 0, but it still shows a border. Weird.)
What features would you like to see?
Posted: November 1st, 2011 under GIS.