newline characters in tick labels

Can a tick label be on two separate lines? For example:

LabelsList = ['Howard', 'Vince', 'Bob', 'Naboo the Enigma']

xlabels = ax.set_xticklabels( LabelsList, rotation=35,
horizontalalignment='right', fontstyle='italic', fontsize='10')

How can I put "Naboo the Enigma" on two lines? I've tried to enter newlines
and carriage returns in the list element (e.g. 'Naboo\n the Enigma') without
any luck.

···

--
View this message in context: http://old.nabble.com/newline-characters-in-tick-labels-tp32852034p32852034.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Actually, that’s how I do it, if I remember correctly. What is your platform and mpl version?

Ben Root

···

On Tuesday, November 15, 2011, magurling <magurling@…287…> wrote:

Can a tick label be on two separate lines? For example:

LabelsList = [‘Howard’, ‘Vince’, ‘Bob’, ‘Naboo the Enigma’]

xlabels = ax.set_xticklabels( LabelsList, rotation=35,
horizontalalignment=‘right’, fontstyle=‘italic’, fontsize=‘10’)

How can I put “Naboo the Enigma” on two lines? I’ve tried to enter newlines

and carriage returns in the list element (e.g. ‘Naboo\n the Enigma’) without
any luck.

Benjamin Root-2 wrote:

Actually, that's how I do it, if I remember correctly. What is your
platform and mpl version?

I have Ubuntu 11.04, Python 2.7.1+, mpl 1.1.0. I've seen examples in the mpl
gallery of two-liner labels, but none that are rotated. Perhaps I didn't
look closely enough.

···

--
View this message in context: http://old.nabble.com/newline-characters-in-tick-labels-tp32852034p32852641.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Seems to work fine for me using GTKAgg. Which backend are you using?

Ben Root

···

On Tue, Nov 15, 2011 at 11:55 PM, magurling <magurling@…1896…> wrote:

Benjamin Root-2 wrote:

Actually, that’s how I do it, if I remember correctly. What is your

platform and mpl version?

I have Ubuntu 11.04, Python 2.7.1+, mpl 1.1.0. I’ve seen examples in the mpl

gallery of two-liner labels, but none that are rotated. Perhaps I didn’t

look closely enough.

Benjamin Root-2 wrote:

Seems to work fine for me using GTKAgg.

I added these lines:

import matplotlib
matplotlib.use('GTKAgg')

I still get the "\n" printed literally in the label (an actual carriage
return shows up as an empty rectangle).

···

--
View this message in context: http://old.nabble.com/newline-characters-in-tick-labels-tp32852034p32858119.html
Sent from the matplotlib - users mailing list archive at Nabble.com.