I have a raster layer with a band with values from -137 to 9229. I want to create a color scheme showing how far from 0 the positive numbers are in one color, and how far from zero the negative numbers are in another color, with a neutral 0 (that, unmistakenly, doesn't lean towards the positive or negative colors, nor diverges from the color scale).

Moreover I'd like a "-55"-area to be just as far from the neutral color (0) as a "+55"-area, but in different colors. So if neutral would be #333, then -5 might be #338, and +5 would be #833, even though the array of values, as in this case, is heavily biased towards positive numbers.

Hope that explains my problem. I'd greatly appreciate any help I get! This is for my Bachelor thesis project on the creation of the metro and highway system in DC during the 50s to 80s.

EDIT: Oh, gosh. I forgot to tell you I'm using QGIS 1.7.4 on an OSX Lion. And have very limited access to Cartographica and ArcGIS full suite.

Best regards, Henrik

  • 1
    What software will you be using for this? Apr 26, 2012 at 12:01
  • 1
    That's what the colormaps in the raster layer's properties are good for. Are you experiencing any troubles with that feature?
    – underdark
    Apr 26, 2012 at 16:43

2 Answers 2


1 Band Raster Plugin will take the existing data and fit a great range of preconfigured palettes(?). This is a quick way to get a very good colour table established. However you will find it is fragile for editing. Nevertheless, I recommend you start here. You might have to be a bit exploratory.

detail is here - http://www.bc-consult.com/freebies.htm

  • I found a plugin called bccAddRColor. Is that the one you're talking about?
    – Henrik
    Apr 29, 2012 at 11:56

You can use the "Colormap" option in the Properties dialog to do this. You can select specific values and colours for each step (i.e. -55 / +55 can be assigned # #FF00FF / #07000B).

  1. Right-click on the raster layer and select Properties;
  2. Under the "Style" tab select Color map: Colormap and press Apply;
  3. Go to the Colormap tab and add the values you are interested in together with custom colors:
    1. Click "add entry" and enter a value;
    2. Double-click the Color column and choose a colour;
    3. Continue until you have all the colours in the ranges you need.

You'll want to select "Color interpolation: Linear" to make sure that all the intermediate values are filled in.

It might be easier to tweak the resulting colormap using a text editor! "Save style" in the Colormap tab and then open the resulting .qml file in a text editor. You'll find a section in this XML file that looks like:

      <colorRampEntry red="255" blue="255" value="-2.300000" green="0" label="Custom color map entry"/>
      <colorRampEntry red="51" blue="51" value="0.000000" green="51" label="Custom color map entry"/>
      <colorRampEntry red="7" blue="179" value="2.300000" green="0" label="Custom color map entry"/>

The RGB values (separately under red="#", etc) can be entered manually, and each value="#" as well.

Have a look at the Colorbrewer site for some good ideas about sequential colour schemes.

  • Thats a good idea. Only thing is that I probably have 200 unique values per layer.. but maybe i could set the value to be between a span of numbers. so instead of value="2", value="3" and value="4" i could just set value="2-4" and chose color for that span of values. Yes?
    – Henrik
    May 4, 2012 at 9:04
  • You can only put single values for each entry. However, if you select "Linear" interpolation, then all the intermediate values between value 'x' and value 'y' are filled by the colours between whatever you chose for x and y. Experiment - once you see how the behaviour works it'll be easy to choose the ranges you need. You'll probably only want 4-6 break points with sequential colours, distributed along your range of values, i.e. -137, -55, 0, 55, 137, 2000, 9000.
    – Simbamangu
    May 4, 2012 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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