[Qgis-developer] Continuous Color style

Mayeul Kauffmann mayeul.kauffmann at free.fr
Wed Nov 10 15:40:03 EST 2010


Hi Luca,
I do not know how to do this in python, but I know how to do it with R.
Since R is GNU/GPL, you can probably take some code from it or use the
same algorithms. Have a look here for some examples:
http://www.r-bloggers.com/color-palettes-in-r/
This R blogger also give a link:
http://research.stowers-institute.org/efg/Report/UsingColorInR.pdf
which is useful even if you do not care about R (see p. 21 sqq on color
models, including Hue-Saturation-Value model, and the references at the
end).


If you are new to R, just type a function name without parenthesis and
type enter. Example session:

> topo.colors
function (n, alpha = 1) 
{
    if ((n <- as.integer(n[1L])) > 0) {
        j <- n%/%3
        k <- n%/%3
        i <- n - j - k
        c(if (i > 0) hsv(h = seq.int(from = 43/60, to = 31/60, 
            length.out = i), alpha = alpha), if (j > 0) hsv(h =
seq.int(from = 23/60, 
            to = 11/60, length.out = j), alpha = alpha), if (k > 
            0) hsv(h = seq.int(from = 10/60, to = 6/60, length.out =
k), 
            alpha = alpha, s = seq.int(from = 1, to = 0.3, length.out =
k), 
            v = 1))
    }
    else character(0L)
}



Hope it helps
Mayeul



Le mercredi 10 novembre 2010 à 00:00 +0100, Luca Delucchi a écrit :
> Hi everybody, I'm working on OGR2Layers python plugin, I'd like to
> implement also continuous color style, but I didn't understand how can
> I assign a style to each features. With also style type like unique
> value or graduated I had all the classes of style (symbols class) with
> continuous color I had only the first (min value) and the last (max
> value), is there some mathematical functions for calculate the
> intermediate classes?
> 
> Thank's
> Luca
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer




More information about the Qgis-developer mailing list