Geographic Information Systems Asked on January 25, 2021
Is there a way in QGIS to make circles that have strokes with different colours and the colour is based on the categories in one of my data fields?
If there is no fill, only the outline, then there is a simple solution. It is a bit more complex to have both categorized fill and outlines.
Set the layer style to be categorized
.
Set the value field, click on the symbol
(or if clicking on the triangle beside it, then select configure symbol
)
Change the simple fill
for a outline line
, eventually set the outline width. Click the top triangle to go back to the main menu.
Select the color ramp, click classify.
If you want fill colors categorized by fieldA and outline colors categorized by fieldB, then you need rule based styling
.
Start with the categorized
style type, use fieldA
and set a color ramp of your choice.
Then change the style type from categorized
to rule based
.
For every rule, right click and select refine current rules / add categories to rule
.
Follow the procedure described above to categorized the outline color (set value fieldB
, change the symbol to be outline line
, set the color ramp, back to main rule)
Repeat for the next rule
Correct answer by JGH on January 25, 2021
Yes, there are ways, but they are clumbersome, if you have a lot of categories.
Number 1 is, as suggest by Dror Bogin, just run the classification and then change each stroke colour manually.
Number 2 is using data defined override:
To the right of almost every setting field in the symbology there's two small stacked rectangles with even smaller triangles attached to them. Hit this button to the right of the stroke colour field, then choose "edit". Adapt and enter the following:
CASE
WHEN "category column" = 'category 1' THEN 'red'
WHEN "category column" = 'category 2' THEN 'green'
WHEN "category column" = 'category 3' THEN 'blue'
ELSE 'pink'
END
"category column"
is the column you want to "classify" your data on, 'category 1'
is the value of your first category (if you have numerical values, leave out the '
). red
obviously is the colour the stroke should have for this category. You also may use RGB-values or HEX-codes. For more details consult the expression builder window. ELSE 'pink'
just catches any incorrectly entered or classified values.
Answered by Erik on January 25, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP