-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] [needs-docs] classifyAroundZero #5161
Conversation
…made to plot data around zero with a colorbar that stay centered and symmetric on zero. Use the prettyBreaks method.
…tedsymbolrendererwidget.cpp
@anitagraser you might be best placed to review the classification logic used here, want to take a look? |
The name of the new mode should indicate that prettyBreaks is used. Otherwise users won't know. I'm not sure a warning is needed when all values are positive or negative. Why not fall back to regular prettyBreaks instead? Could 'symmetric around zero' be an option for all modes? Then it could be a checkbox. I don't have a build environment set up, so I cannot comment on whether it actually works ok. |
Hello, |
What I'm interested to know is whether there's any "standard"/"scientifically accepted" techniques used for classification in this situation. @anitagraser are you aware of any? I'd like to make sure we're not implementing our own algorithm here when there's a standard one we should be using instead. |
I'd have to check what the cartography literature has to say about this. |
I think a generic design will be able to support more use cases. One approach would be a checkbox "symmetric around" followed by a numeric input field with default value 0.0 because, as @cartocalypse pointed out correctly on Twitter, other values can be "the center" as well. |
My check box is ready ! |
I'm not sure I follow / see the problem. For pretty breaks, the input could be restricted to only allow whole numbers. A "stupid" classifier, where the user specifies the class size, would also be useful sometimes but that's a different discussion in my opinion. |
I guess you mean "For pretty breaks, the input could be restricted to only allow values determined as breaks/pretty". That seems fair. |
Hello, |
Feature freeze is end of October for QGis 3: https://www.qgis.org/en/site/getinvolved/development/roadmap.html So you still have time |
Hi @pierreloicq - thanks for looking into this issue! I think we are talking about bi-polar color ramps here. But I don't think that we should introduce a new classification method for this special case. As to my understanding, this is trying to make sure that classes are symmetric around a certain point (be it 0, 1, 100). I agree with @cartocalypse (Twitter) that we should not restrict this to zero only. There are valid use cases to have the symmetry around 1 or 100 or other values. This method would have to be restricted to "odd" numbers of classes - right? "even" numbers wouldn't result in a symmetric distribution around a center class - right? Or how would this work with f.e. six classes? Also, couldn't this "symmetry" be implemented for all the other classification methods as well, or what is so special about pretty breaks here? |
Hello, The symmetry may be applied on all the methods that have a constant break distance (equal interval, s.d. method and pretty breaks). You see here that methods will be different for each methods. For the prettyBreaks method, the symmetry point can only be a pre-existing break and the class located on the symmetry point is 2x larger than the others. I don't see how we could apply it to the Jenks and quantile method since distance between breaks is not constant by definition. |
@cartocalypse here :) First of all, this is a feature I long wished for so that you very very much for working on it! I meant to jump into this discussion earlier, sorry for forgetting. I agree that this would be best as additional feature, not a new method. For the standard deviation classification method I think it should only be allowed with the mean as pivot, otherwise it makes no sense (to my understanding). To me there are three options that one needs to choose: a) Symmetric around:
b) Number of classes to each side c) The kind of method to use So how about having a new widget in the same line as the Mode and Classes widgets that gets enabled on supported modes and let's the user toggle it and set the pivot? If used, restrict the number of classes to multiples of 2. For potential future work I would like to draw attention to the histogram, where mean and stdev are displayed. It would be fantastic if one could set the pivot there as a special class break. Again, this is a great feature, it will make working with QGIS much easier! |
Hello, |
Description
I added a new method of classification in the graduated methods. It is aimed at plotting data that are centered on zero, with a class around zero (like [-1,1] instead of [-1,0],[0,1] ), and with a colorbar that stay symmetric around zero. It uses the prettyBreaks method. If data are all positive or negative, an alert box appear.
It didn't pass every test (I guess it's normal since some test not passed were very far from what I modified)
It passed the test qgis_graduatedsymbolrenderertest. I didn't add anything in this test.