ENH: allow non-monotonic contour levels#31237
ENH: allow non-monotonic contour levels#31237jklymak wants to merge 3 commits intomatplotlib:mainfrom
Conversation
|
Test failures are unrelated so far as I can tell... |
|
If I remember correctly, we decided to make the interfaces consistent since the APIs are so similar. |
|
I don't see a strong argument for consistency here. If the inputs were contradictory that would be a problem, but the allowed |
|
Thoughts, @ianthomas23? |
Personally I'm not in favour of introducing differences between |
|
The |
|
I think this needs more documentation as the removal of the order opens up room for ambiguity. AFAICS:
Is that correct? |
Thats correct, and I think that would be expected behaviour. A color list is an ordered list that goes with the ordered list of levels. A colormap maps from a value to a color, so I think the expected value to use is level. I've mildly updated the docs to state this. I don't think we need to go overboard with documenting this - I'm not claiming we should encourage this usage, just that I don't think it should fail arbitrarily |
|
From the discussion in #31227
I don't see any issue with supporting monotonically decreasing levels if it's feasible. And then doing it for both Not requiring |
|
Yeah, this PR doesn't go as far as allowing filled |
|
There are two developers who have stated that they are against this particular change (allowing discrepancy between contour and contourf). |
|
Just noticed that Scott's comment was edited to include his approval of non-monotonic constraint of contour, so I'll edit my comment to take that part out. There are still two devs that have expressed opposition to this change. |
|
@WeatherGod I've still not understood why breaking "consistency" would lead to problems. I'm all for consistent APIs when they lead to less confusion, cleaner code, or to avoid overly convoluted documentation (probably in that order), but in this case it seems to just be a restriction for consistency's sake. |
This removes the restriction on
contourneeding to have monotonically increasing contour levels. No sorting of the levels is done. The documentation change is trivial.This restriction was put in for
contourf, #5477, but doesn't seem necessary forcontour.Addresses #31227