Feature request #9303
Add a switch to reverse colours and invert palette
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Symbology | ||
Pull Request or Patch supplied: | No | Resolution: | fixed/implemented |
Easy fix?: | No | Copied to github as #: | 17911 |
History
#1 Updated by Etienne Tourigny almost 11 years ago
It is possible to invert the gradient in rasters (before classifying), but not in vectors. It should be easy to add a "invert" checkbox next to the color ramp selector in the Categorized and Graduated modes.
Updating the various gradient dialogs to support inverted colors would be somewhat more involved.
IMHO inverting palette is not feasible with cpt-city gradients.
#2 Updated by Etienne Tourigny almost 11 years ago
- % Done changed from 0 to 50
Added invert checkbox for vector layer classification (Categorized and Graduated) in 0a8c1ccd090f28efe2706e6f56d8ce2861867496 .
I am not sure that "inverting palette" is so useful (and honestly difficult or impossible for cpt-city gradients), but it could be added to the standard gradient dialog.
Leaving this open for now.
#3 Updated by Etienne Tourigny almost 11 years ago
Actually, implementing "invert palette" shouldn't be too hard.
The question is, where should this option appear? In the gradient dialog boxes, or in the raster/vector classification UIs (as is done for "invert colors")?
Another question is: is this really necessary?
Here is the relevant code in the 1-band raster colour table plugin (bcccoltbl), in file Palette.py, that does the inversions.
# interfaces to export useful objects def getColPalette(self, bInvert = False, bReverse = False): """ -- return the colour palette array """ if bInvert: #invert the colour palette for i in range(self.nColo+1): self.arColo[i,0] = 255 - self.arColo[i,0] self.arColo[i,1] = 255 - self.arColo[i,1] self.arColo[i,2] = 255 - self.arColo[i,2] if bReverse: #reverse the colours order ar = np.zeros((self.nColo+1,4),int) n = self.nColo for i in range(self.nColo+1): ar[i,0] = self.arColo[n -i,0] ar[i,1] = self.arColo[n -i,1] ar[i,2] = self.arColo[n -i,2] self.arColo = ar return self.arColo
#4 Updated by Etienne Tourigny almost 11 years ago
Added a few people to this ticket, would appreciate feddback on questions raised in last comment.
#5 Updated by Paolo Cavallini almost 11 years ago
Not sure it is necessary. I'd put it besides the "invert colour" checkbox.
#6 Updated by Giovanni Manghi over 7 years ago
- Easy fix? set to No
#7 Updated by Paolo Cavallini over 6 years ago
- Resolution set to fixed/implemented
- Status changed from Open to Closed
Implemented