not so simple,
If you use the colour function  to set the symbol colours using data
defined styles, then use the categorised fields to get the text labels for
the symbols, the wrong colours show up on the legend, although they are
fine on the map.
if you just use a single symbol with the data defined styles you only get
one colour in the legend.
The trick, and the problem is that although the colours in the r, g  and b
fields in the table match the geological type, there is no way for QGIS to
make that relationship. It does not know that all of the polygons with the
geological type rock1 have the same colour, all that it knows is that each
polygon with the same  r,g,and b value are colour x. it doesn't use the
geological type at all to make this determination.

tough problem
I thought you could try to  categorise it by the colour rgb  function then
change it to rule based and edit the labels to become the correct geology,
but even then the colours in the legend are still going to be wrong and
different to the ones on the map.

my suggestion would be to put in a change request that the legend colour
match the first occurence of the rgb colour for a given rule when using
data defined styles.

As a work around the only thing i can think of  is to set the colours using
the data defined style, apply, then categorise by the geological type and
use the colour picker to get the colours right in the legend from the map.
I would suggest labelling by the geol type to ensure you have the colours


On Thu, Nov 17, 2016 at 10:59 AM, alvarets <> wrote:

> Of course. Just like any other legend.
> --
> View this message in context: http://osgeo-org.1560.x6.
> Sent from the Quantum GIS - User mailing list archive at
> _______________________________________________
> Qgis-user mailing list
> List info:
> Unsubscribe:
Qgis-user mailing list
List info:

Reply via email to