Skip to main content
clarification
Source Link

You can achieve this by importing the colors as a color ramp. First categorize your layer the way you want. Then:

  1. Save an new (empty or just create some random values. This step is just to get an empty, working .gpl-file) color ramp from the QGIS Layer styling (.gpl-file)
  2. In a spreadsheet, order your legend entries with their r,g,b-values in the same order as your categories in QGIS (i.e. by increasing stratigraphic order). Copy the color values to clipboard.
  3. In a text editor, paste the r g b-values (space between r g b) into the empty color ramp-file.
  4. Open this new color ramp in the QGIS Layer styling for that layer
  5. You have correct colors in the legend. Also negates the need for data defined colors. You can save the .qml style together with your data for easy re-use.

This does not work if several units have the same color.

You can achieve this by importing the colors as a color ramp. First categorize your layer the way you want. Then:

  1. Save an new (empty or just create some random values. This step is just to get an empty, working .gpl-file) color ramp from the QGIS Layer styling (.gpl-file)
  2. In a spreadsheet, order your legend entries with their r,g,b-values in the same order as your categories in QGIS (i.e. by increasing stratigraphic order)
  3. In a text editor, paste the r g b-values (space between r g b) into the empty color ramp-file.
  4. Open this new color ramp in the QGIS Layer styling for that layer
  5. You have correct colors in the legend. Also negates the need for data defined colors. You can save the .qml style together with your data for easy re-use.

This does not work if several units have the same color.

You can achieve this by importing the colors as a color ramp. First categorize your layer the way you want. Then:

  1. Save an new (empty or just create some random values. This step is just to get an empty, working .gpl-file) color ramp from the QGIS Layer styling (.gpl-file)
  2. In a spreadsheet, order your legend entries in the same order as your categories in QGIS (i.e. by increasing stratigraphic order). Copy the color values to clipboard.
  3. In a text editor, paste the r g b-values (space between r g b) into the empty color ramp-file.
  4. Open this new color ramp in the QGIS Layer styling for that layer
  5. You have correct colors in the legend. Also negates the need for data defined colors. You can save the .qml style together with your data for easy re-use.

This does not work if several units have the same color.

Source Link

You can achieve this by importing the colors as a color ramp. First categorize your layer the way you want. Then:

  1. Save an new (empty or just create some random values. This step is just to get an empty, working .gpl-file) color ramp from the QGIS Layer styling (.gpl-file)
  2. In a spreadsheet, order your legend entries with their r,g,b-values in the same order as your categories in QGIS (i.e. by increasing stratigraphic order)
  3. In a text editor, paste the r g b-values (space between r g b) into the empty color ramp-file.
  4. Open this new color ramp in the QGIS Layer styling for that layer
  5. You have correct colors in the legend. Also negates the need for data defined colors. You can save the .qml style together with your data for easy re-use.

This does not work if several units have the same color.