7

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).

enter image description here

  • 1
    You can set your classes manually - just 'delete all' then 'add class' to the breaks that you're after - is that what you're trying to do? – DPSSpatial Jan 5 '16 at 19:54
  • This is exactly what I ment with the last sentence in brackets. I know, this is a possible way to do it, but to get a reasonably good resolution (in terms of classes) this means a lot of hand work and has to be completely repeated when you want to change the range. This is why I'm searching for a more automated way, like specifying min/max/nr_of_classes and let QGIS do the rest. – Ludwig Jan 6 '16 at 11:24
  • You could probably do this in an expression - next to the Column drop down there is that E - i'll bet you could write how you wanted to break down the columns and even put some math in there to create your breaks... that might do the trick... – DPSSpatial Jan 6 '16 at 16:35
3

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.

1

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.

1

Seems to be impossible to do automatically in Graduated style, but here is a workaround by setting the color with an expression:

Select a 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 Column of Graduated style is no good for centering zero: whatever comes out from that expression, the classifier doesn't know where zero is.)

  • This is the best answer here at first sight... but the downside is that there's then no legend :-( – Flyto Jul 3 at 17:34
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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