13

How to create vertical labels (each label in new line) like:

1998
150
pipe name

and not horizontal:

1998 150 pipe name
12

You can use a QGIS expression in the label expression.

"Date" || '\n' || "Size" || '\n' || "name"

You can even wrap the expression over multi lines to do the same thing

"Date" || '
' || "Size" || '
' || "name"

Note the ' at the end and start of each line. The first is clearer with its intentions so I would use that.

8

An alternative to Nathan's excellent reply is to use the new labeling tab in QGIS 1.9 (also available in 1.8 but not from the layer properties menu. Instead go to Layer->Labels).

If you scroll down on the label settings tab you will find a Multiple Lines option, where you can specify the character to wrap the line on. This will be helpful if you are concatenating your string using something other than a newline character (as per Nathan's reply) or you have a string that is held in a single field (I often have to contend with slightly 'messy' data from other sources like this).

The other advantage of the multiple lines option is that you can specify alignment and line height too. So you could concatenate using spaces and then align centrally or to the right with a 1.5 line spacing (if that is cartigraphically appealing).

e.g. "Date" || ' ' || "Size" || ' ' || "name"

...with wrapping set to a single space plus align set to 'right' might give you something like:

     1998
      150
pipe name
2

From QGIS version 2.12 you can use rule-based labeling: a rule for each field; In the screenshot you can see how to do it !!! enter image description here

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.