QGIS
QGIS copied to clipboard
Wrong styling with categorized renderer (negative values styled as positive).
What is the bug or the crash?
Wrong styling with categorized renderer (negative values styled as positive or some colours applied outside colour ramp)
Steps to reproduce the issue
Load the attached "sampled points" layer into QGIS. Inspect and you will see that many of the points with negative (calculated) values are coloured as if they are positive - see screenshot above.
Clicking reclassify creates extra classes with an orange symbol (outside the colour ramp!) and styles most of the points with these! Not sure why that didn't happen when I first styled the layer.
Experimenting to understand what's going on, when I try editing the classification value to put it inside a round( ,3)
and clicking "Apply", all the points turn orange. When I click "Classify" I get a single green class.
Reset to default style and then try editing the classification value to put it inside a round( ,3)
and clicking "Apply", all the points turn green. Click classify and everything is fixed (I think).
Remove the round( ,3)
and click apply - everything goes green again. Click classify and everything is fixed again.
Try loading the other layer and copy-pasting the style onto it, and it is probably also styled wrong, until you click "Classify".
Versions
valid for 3.28, 3.32, and a recent nightly.
QGIS version
3.32.0-Lima
QGIS code revision
311a8cb8a65
Qt version
5.15.3
Python version
3.9.5
GDAL/OGR version
3.7.0
PROJ version
9.2.1
EPSG Registry database version
v10.088 (2023-05-13)
GEOS version
3.11.2-CAPI-1.17.2
SQLite version
3.41.1
PDAL version
2.5.3
PostgreSQL client version
unknown
SpatiaLite version
5.0.1
QWT version
6.1.6
QScintilla2 version
2.13.1
OS version
Windows 10 Version 2009
Active Python plugins
annotationManager
0.5
AnotherDXF2Shape
1.2.7
BoundingBox
2.1
changeDataSource
3.1
civilplan
1.0
coveragebuilder
version 0.5.0
Equal_area_slope_QGIS_Plugin
0.1
file_management
0.1
FlowEstimator
0.21
GeoCoding
2.19
geometry_paster
0.2
geoprocAlgos
3.30
group_transparency
0.2
joinmultiplelines
Version 0.4.1
LayerBoard
1.0.1
layout_panel-main
0.3
MemoryLayerSaver
5.0.0
merge_selected_features
0.1
nominatim
1.4.5
pathfinder
version 0.4.2
plugin_reloader
0.9.3
precisioncursor4qgis-main
0.2E
QCopycanvas
0.7
qgis-polygonizer
0.1
qgis_resource_sharing
1.0.0
QlrBrowser
3.0.0
quick_map_services
0.19.33
rename_bands
0.1
reveal_address_plugin
1.2
segment_reshape_plugin
0.1.4
StyleLoadSave
1.0
switch_active_layer
0.1
valuetool
3.0.15
workbench
0.0.4
db_manager
0.1.20
grassprovider
2.12.99
MetaSearch
0.3.6
processing
2.12.99
### Supported QGIS version
- [X] I'm running a supported QGIS version according to [the roadmap](https://www.qgis.org/en/site/getinvolved/development/roadmap.html#release-schedule).
### New profile
- [X] I tried with a new [QGIS profile](https://docs.qgis.org/latest/en/docs/user_manual/introduction/qgis_configuration.html#working-with-user-profiles)
### Additional context
If I remember correctly I started with a memory layer created by a processing algorithm, and because of this style problem I saved it to file to see if it still had the same problem.
I'm not certain which version of QGIS originally created the style, but you can see the QML file is written by 3.28.8.
QGIS 3.22 also has the reported behavior.
@AlisterH,
Load the attached "sampled points" layer into QGIS. Inspect and you will see that many of the points with negative (calculated) values are coloured as if they are negative - see screenshot above.
[I think you meant "as they are positive"]
This is because the layer style doesn't contain all the needed classes, and the "all other values" class has a green color (like for positive values), so the points with negative (and also positive) values that are missing among the classes are styled in green.
Clicking reclassify creates extra classes with an orange symbol (outside the colour ramp!) and styles most of the points with these! Not sure why that didn't happen when I first styled the layer.
Just first deleting all the classes ("Delete all") and then recreating all of them ("Classify") creates all the classes styled in the color ramp range.
Clicking on the "Classify" button when there are already some classes, then the added classes are just appended and styled with the symbol set in the Symbol parameter (i.e. a yellow point marker)
If clicking on the "Classify" button when there are already some classes would behave like first clicking on "Delete all" and then on "Classify", why the need to have a "Delete all" button?
QGIS 3.22 also has the reported behavior.
@AlisterH,
Load the attached "sampled points" layer into QGIS. Inspect and you will see that many of the points with negative (calculated) values are coloured as if they are negative - see screenshot above.
[I think you meant "as they are positive"]
Yes, quite right, thanks.
This is because the layer style doesn't contain all the needed classes, and the "all other values" class has a green color (like for positive values), so the points with negative (and also positive) values that are missing among the classes are styled in green.
No, that's not what's happening. Check and see - the original classes extend from -1048 to 1.41, but the new orange classes only extend from -1.36 to 1.37.
Just first deleting all the classes ("Delete all") and then recreating all of them ("Classify") creates all the classes styled in the color ramp range. Clicking on the "Classify" button when there are already some classes, then the added classes are just appended and styled with the symbol set in the Symbol parameter (i.e. a yellow point marker)
If clicking on the "Classify" button when there are already some classes would behave like first clicking on "Delete all" and then on "Classify", why the need to have a "Delete all" button?
OK, if that's the intended behaviour then it makes sense, but it is not the actual behaviour.