How to set vertical text direction in QGIS
If you are using QGIS 3.10 or later, set the orientation to vertical in the Labels > Formatting
.
See also the Visual changelog.
Enjoy!
For younger than QGIS 3.10 versions, e.g. QGIS 3.4 open 'Layer Properties > Labels > Expression Dialog'
In 'Function Editor'
create a new function with such code:
from qgis.core import *
from qgis.gui import *
@qgsfunction(args='auto', group='Custom')
def string_to_list(field, feature, parent):
field_as_list = list(field)
field_as_list_rot = []
for i in field_as_list:
field_as_list_rot.append(i + '\n')
return field_as_list_rot
Apply 'Save and Load functions'
And then slightly adjust the expression that has to be used as this one
regexp_replace(array_to_string(string_to_list("Name")),',','')
where array_to_string()
and regexp_replace()
are native QGIS functions
Click 'Apply'
and get the result
Using QGIS 3.10 you can actually change the text direction under labels > formatting
from horizontal
to vertical
.