We can activate labeling by going to Layer Properties | Labels, checking Label this layer with, and selecting the attribute field that we want to use for the labels. This is all we need to do to display labels with default settings. While default labels are great for a quick preview, we usually want to customize the labels if we create visualizations for reports or stand-alone maps.
Using Expressions (the button that is right beside the attribute drop-down list), we can format the label text to suit our needs. For example, the NAME field in our sample airports.shp
file contains text in uppercase. To display the airport names in mixed case instead, we can set the expression title(NAME)
, which will reformat the name text in title case. We can also use multiple fields to create the label, for example, combining name and elevation in brackets using the concatenation operator ||
as follows:
title(NAME) || ' (' || "ELEV" || ')'
Note the use of simple quotation marks around text such as...