I'm working with QGIS 2.12.1-Lyon in Ubuntu 14.04 LTS. I really like the features of this nice program but I'm badly missing one thing. Quite regular I'm working with differences. For displaying I use a graduated polar style with white for zero and red/blue for the ranges in +/- direction. This works pretty well with raster data, where I can manually set the min/max values. Unfortunately as you can see on the screenshot, setting this range is not possible for vector data (or did I just not find it?). This has the consequence that if data is not equally distributed around 0, the colours can't be interpreted that easily. Is there another way to manually set the colour range for vector layers? (I don't want to manually edit each single class as I'm loading such data quite often and this could get very annoying).
Finally I found a solution. As it is not possible to adjust the limits of color range manually, it is at least possible to set the ranges of every class manually. Instead of doing this again and again for every profile, it is then possible to save it and just load the style in other projects. Within the same project it is even possible to copy and paste the styles from other profiles.
I needed to apply the same style to data with different column names. What realy helped me is that it is possible to "copy style" and then paste it in notepad and copy-paste anything you like from one file to another.
Seems to be impossible to do automatically in
Graduated style, but here is a workaround by setting the color with an expression:
Single symbol style. Go to
Simple fill under
Fill, and open the expression editor of
Fill color. Enter this:
ramp_color('RdBu', scale_linear(DH, <lowerbound>, <upperbound>, 0, 1) )
'RdBu' is the gradient's name (red to blue in this case), <lowerbound> and <upperbound> are the limits.
If you want to have zero to be at the the middle of the gradient, just set the upper and lower bounds to be the same (-x...+x). To do it automatically:
ramp_color('RdBu', scale_linear(DH, min(minimum(DH),-maximum(DH)), max(maximum(DH),-minimum(DH)), 0, 1 ) )
(Putting an expression in
Graduated style is no good for centering zero: whatever comes out from that expression, the classifier doesn't know where zero is.)
Although not an amazing solution, I ended up creating a vector feature far off with max and min values I would like to use. When you classify Graduated, it seems to work fine. Equal Interval or Pretty Breaks works better than Natural Breaks as the distribution of data is not great.