[GIS] Apply a different color ramp to subset of categorized symbols in QGIS

color rampqgis

The goal is applying a color gradient to a subset of symbols, instead of applying it to all the existing symbols. I used to do this in ArcMap. In QGIS I have to do it manually, and it's very time consuming. Also, the results are not as beautiful, because I am not as good in choosing right colors.

This is the final result of doing individual ramps for each symbol group or subset:

This is the final result of doing individual ramps for each symbol group or subset

And this is the styled map:

And this is the styled map

Best Answer

  1. Select the categories you want to apply the first color ramp to. Right click > merge categories. enter image description here
  2. Repeat step 1 for each group.
  3. Convert the layer from Categorized to Rule-based style. This will automatically convert each grouped category into a rule with an expression like "type" IN ('type 1','type 2','type 3','type 4','type 5').
  4. Select one of the rules > Refine selected rules > Add categories to rule enter image description here
  5. Set up categories for this group and apply the desired color ramp. Note that when you click "classify", categories will be created for all attribute values, including ones outside the group. You'll need to manually remove the extra categories.

    enter image description here

  6. Repeat step 5 for each rule.
  7. Now you have several main rules with categorized rules nested underneath each rule. Turn off the symbol for each of the main rules, so that only the color ramp styles remain.

    enter image description here

enter image description here