wrapping y axis tick labels?

How possible would it be to wrap y axis tick labels after a certain
text length? I have a horizontal bar plot where some bars' labels are
too long and therefore cut off. I can scrunch the width of the whole
plot to accommodate them, but I'd much rather wrap long text and allow
a little more space to accommodate two lines. For examples:

I'd like to go from this:

                               a short axis label | ======================

A very long axis label that gets cut off | =============

To this:
                               a short axis label | ======================

                        A very long axis label | =============
                                that gets cut off

Is this possible or has it ever been done?

Thanks,
Che

Not automatically, but you can always manually break up a line of text with a ‘\n’ in the string. Automatic/intelligent line wrapping has always been a requested feature, but would be very difficult to implement correctly. Therefore, the recommendation is for manual usage of newlines.

Cheers!
Ben Root

···

On Fri, Jul 20, 2012 at 10:55 PM, C M <cmpython@…287…> wrote:

How possible would it be to wrap y axis tick labels after a certain

text length? I have a horizontal bar plot where some bars’ labels are

too long and therefore cut off. I can scrunch the width of the whole

plot to accommodate them, but I’d much rather wrap long text and allow

a little more space to accommodate two lines. For examples:

I’d like to go from this:

                           a short axis label |  ======================

A very long axis label that gets cut off | =============

To this:

                           a short axis label |  ======================



                    A very long axis label  |   =============

                            that gets cut off

Is this possible or has it ever been done?

Thanks,

Che

How possible would it be to wrap y axis tick labels after a certain
text length? I have a horizontal bar plot where some bars' labels are
too long and therefore cut off. I can scrunch the width of the whole
plot to accommodate them, but I'd much rather wrap long text and allow
a little more space to accommodate two lines. For examples:

I'd like to go from this:

                                a short axis label | ======================

A very long axis label that gets cut off | =============

To this:
                                a short axis label | ======================

                         A very long axis label | =============
                                 that gets cut off

Is this possible or has it ever been done?

Thanks,
Che

Not automatically, but you can always manually break up a line of text with
a '\n' in the string. Automatic/intelligent line wrapping has always been
a requested feature, but would be very difficult to implement correctly.
Therefore, the recommendation is for manual usage of newlines.

For the OP an example is here http://matplotlib.sourceforge.net/examples/pylab_examples/barchart_demo2.html

···

On 21/07/2012 05:15, Benjamin Root wrote:

On Fri, Jul 20, 2012 at 10:55 PM, C M <cmpython@...287...> wrote:

Cheers!
Ben Root

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
Cheers.

Mark Lawrence.

You might want to look at the python textwrap module. That can take
your labels and automatically wrap them at a certain column width. See
(in addition to the official python docs)
http://www.doughellmann.com/PyMOTW/textwrap/

Jon

···

On Fri, 2012-07-20 at 23:55 -0400, C M wrote:

How possible would it be to wrap y axis tick labels after a certain
text length? I have a horizontal bar plot where some bars' labels are
too long and therefore cut off. I can scrunch the width of the whole
plot to accommodate them, but I'd much rather wrap long text and allow
a little more space to accommodate two lines. For examples:

I'd like to go from this:

                               a short axis label | ======================

A very long axis label that gets cut off | =============

To this:
                               a short axis label | ======================

                        A very long axis label | =============
                                that gets cut off

Is this possible or has it ever been done?

Thanks,
Che

--
______________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
jslavin@...1081... 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
cell: (781) 363-0035 USA
______________________________________________________________