1

I have more than 3 attributes to add to pie charts in QGIS, so I need a patterned fill e.g.dots, lines. Using a grey scale gives white, black and grey but using different shades of grey doesn't work Any suggestions?

  • Why can't you use colours? That would make it easier to differentiate. – MappaGnosis Oct 17 '14 at 8:35
  • $375 charge and no funds :-) – k.morgan Oct 17 '14 at 14:50
  • Fair enough! I have no nice solution in QGIS (I don't think there is one) but I do have a very nasty work around (see below). – MappaGnosis Oct 17 '14 at 15:52
1

I don't know of any way (at the time of writing) to use textures instead of colours for the pie charts but here is a possible (if somewhat nasty) work-around:

Make your pie-charts and use clear simple colours with strong solid black lines and style the layer so that there is nothing but the pie charts. Zoom your map to get the best view of your pie charts as they will be displayed in your Composer (very important) - i.e. they will not get clipped. Now turn EVERYTHING off except the layer with the piecharts. Using Project->Save As Image create a georeferenced screenshot of the map window. You should now have a georeferenced image with a white background and coloured pie-charts in bold distinct colours (do not move or delete the WLD file).

Now switch to Photoshop or GIMP. Use the eye-dropper tool to 'pick-up' a colour. Then switch to the select by colour tool (usually a variant of the magic wand) and turn its tolerance down if necessary (this is why you need distinct colours - the starting image can look awful so long as the colours can be easily distinguished by your image editor). Then select all areas in all pie charts in one go (selecting by colour avoids having to click on or outline every portion of pie individually - which is why this solution is workable). Now switch to your fill tool (commonly a paint-bucket) and choose or create a texture as required. Fill the areas (there is usually an option to fill all selected areas). Rinse and repeat until done. It actually should not take too long as you don't have to select or fill each little portion of pie individually. Change the image mode to be gray-scale and then save the result (in GIMP use export and turn off "Progressive" in the advanced options - important).

Now switch back to QGIS and load your piecharts image as a raster layer (remember it is georeferenced courtesy of the WLD file automatically created when you first saved it). In the layer properties, set white to to be 100% transparent (you could also set some layer transparency to taste) but now you should have all your pies with textures in B&W. It should also scale with your map (though resolution may be an issue).

Obviously now restyle your vector 'piecharts' layer not to show pie charts anymore!

OK - I know - it is a little fiddly but should not be too onerous and could get you out of a hole in the absence of a 'proper' solution. I'm assuming that the variety of options for the Pies is unpredictable or more than say half a dozen distinct configurations - I have another nasty solution for that eventuality :)

  • Wow! I had a solution, which was to export the map as a JPG and then create pie charts in Excel and overlay them onto the pie charts already on the map and then re-save. Works but alters the sharpness slightly – k.morgan Oct 17 '14 at 22:55
  • With the above method, you can also increase the resolution of your piecharts layer. You could scale the whole image to be, say, twice the size and thus improve the sharpness (use thin black lines when making the pie charts). You then need to tweak the WLD file. If you double the size of the image, halve the X and Y dimensions in the WLD (check out how a WLD works if you are not sure - there are loads of threads about world files on this board). – MappaGnosis Oct 18 '14 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.