2

Maybe a pretty simple question. I have a polyline shapefile that I've symbolized through categories, and I wish for the labels to automatically be set to the same color as it's corresponding line segment. Therefore, if I end up changing the symbology in the future the labels will update accordingly. Is this possible, maybe through the expression feature in the labeling options? (I'm very new to qgis).

3

There are a couple of solutions that spring to mind. The first is to create a field in your data that you can use an expression to set the RGB value dependent on your data. Then use this as the expression for both the fill color and text color (accessed by the little 'Data defined' tab beside each color picker).

Another alternative would be to use rules-based symbology and duplicate identical rules for rules based labeling (requires QGIS 2.12 or above). By combining this with layer-level variables you can simplify the process of changing your rules. See the example here. You don't need to use layer-variables, but it can be helpful.

  • Awesome, this is just what I needed to get started. Thanks! – Andy Fisher May 24 '16 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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