5

I have several line layers which i am trying to style with random colors. I want the lines styled in such a way that adjacent lines are assigned different colors so that each is clearly differentiated. I tried applying Categorized styling using an attribute that is unique, the result had instances where adjacent lines were the same colors. I found a plugin and some tutorials on doing the same for polygons.

Four color theorem for QGIS? (4 colour)

Consistent layer colors that are automatically adjusted based on adjacent polygons?

Would it be possible to do the same for lines. I am using QGIS 2.18.3

Sample output

1
  • Although the two indicated lines may look they have similar color, but the blue levels are different. You can reload the categorized random color style several times until you get satisfied with the results.
    – ahmadhanb
    Commented Dec 22, 2017 at 6:29

1 Answer 1

2

Based on an answer by @Eric Darchis on another post Four color theorem for QGIS? (4 colour) i found the solution helpful and was able to replicate it to achieve desired result. The steps listed below are a direct copy of the solution written by @Eric Darchis

  • View → Panels → Processing Toolbox
  • Select Topological coloring
  • Set parameters as preferred. Run.
  • This will create a new layer with an additional color_id column but still the same color.
  • Edit the properties of the new layer, Symbology section.
  • At the top, drop down to select Categorized.
  • Define the column as color_id.
  • Select your color scheme.
  • Click Classify to create the categories and assign them the colors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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