[Qgis-developer] color ramps for vector graduated
symbols (ticket #782)
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Thu Nov 1 04:35:59 EDT 2007
Marco Hugentobler wrote:
>>The MatLab colour map editor is show here (scroll down a little for a
>>screenie):
>>
>>http://tinyurl.com/27gbra
>
>
> That looks great!
I wrote a colour ramp editor in Python for Qt, based on some C++
source I think I found in the Qt examples. It returns a
QtGui.QLinearGradient object. You get the little triangles for dragging
around the map, you can double click to add new colours and so on.
Go here and get rampEditor.zip, then run "python RampEditor.py" - its
only two files and extracts to the current directory:
http://www.maths.lancs.ac.uk/~rowlings/Geog/Qgis/
(obviously you need PyQt4 module for your python).
I wrote it as a widget that can be inserted into dialogs. When you run
the example you'll see my gradient widget and a "colour square" widget
below. This is for testing drag-n-drop. Right-click on the colour square
(I should add a double-click option) to choose a colour, then drag and
drop this onto the gradient bar.
Gradient bar triangles can be dragged and double-clicked. I'm sure
they can be deleted... Somehow... Oh, maybe that needs adding. I think
there may be some off-by-one errors in the triangle placement too.. This
is work in progress....
The grooviest ramp editor I've seen is in Adobe Illustrator, where you
basically draw a spline that interpolates between your colours in
whatever colour space you are interested in. Hence you can easily create
colour ramps in hue and saturation as well as linear RGB values.
Also, it may also be worth looking into the ColorBrewer palettes for
presets for classifications:
http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer_intro.html
Barry
More information about the Qgis-developer
mailing list