Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to give multiple colors to different features within a shapefile based on attribute values , is this possible in QGIS ?

If yes what is the procedure ?

Is there a way to provide color by means of hexadecimal codes ?

share|improve this question
QGIS project offers a very good manual: I suggest reading it. – underdark Feb 16 '12 at 9:09
up vote 15 down vote accepted

You can change the styles of the shape file in the layer properties. Double click the layer and select style.
Select Categorized style and choose a field you want to visualize. Remember to classify your values before leaving the dialog.Style dialog in QGIS.

share|improve this answer

if I understood you right this great tutorial should answer your question:

p.s. from the same author there is alos a follow-up:

share|improve this answer
yes actually your answer is more pertinent to my question but i accepted the other as answer was for a more general case – GeoH2O Feb 16 '12 at 17:22

Alternatively to categorized styling, if you want to play a bit with colour you can try to code it by yourself:

    WHEN Field = 'Value1' THEN color_rgb(0, 176, 80) 
    WHEN Field = 'Value2' THEN color_rgb(255, 255, 0)
    WHEN Field = 'Value3' THEN color_rgb(255, 192, 0)
    WHEN Field = 'Value4' THEN color_rgb(255, 0, 0)
    WHEN Field = 'Value5' THEN color_rgb(192, 0, 0) 
    WHEN Field = 'Value6' THEN color_rgb(255, 0, 255)
    color_rgb(0, 0, 0)    

You can also apply rand function inside color_rgb

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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