Limiting Labels Length for Axis and Legends

Use the lablim parameter in scale_xxx() functions to specify the maximum length (number of characters) of labels for correspondent axis or legend.

Labels exceeding the specified maximum lenfth will be trimmed.

In [1]:
from lets_plot import *
LetsPlot.setup_html()

1. Long Labels without Trimming

In [2]:
data = {
    'x': ['A picture is worth a thousand words', 'Make a long story short']
}

p = ggplot(data, aes(x='x', color='x')) + geom_point(size=7)
p
Out[2]:

2. Use lablim Parameter to Trim X-Axis Labels

In [3]:
p + scale_x_discrete(lablim=10)
Out[3]: