title: How to cut long labels in Matplotlib
body: <p>I would like to cut long labels, so that only the first 4 letters are displayed, without changing the values in the original data frame.</p>
  
  <p>Example:</p>
  
  <pre class="lang-py prettyprint-override"><code>import pandas as pd
  import numpy as np
  import matplotlib.pyplot as plt
  import seaborn as sn
  
  np.random.seed(89)
  
  # Toy Dataset
  d = pd.DataFrame(np.random.randint(0,3, size=(100, 1)), columns=['var'])
  d['var'] = (np.where(d['var'] == 1,'Long loooooong loooooong text',d['var']))
  
  # Plot
  f, axes = plt.subplots()
  sns.countplot(y='var', data=d, orient='h');
  </code></pre>
  
  <p><strong>Current output</strong>:
  <a href="https://i.stack.imgur.com/wD9wH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wD9wH.png" alt="enter image description here"></a></p>
  
  <p><strong>Desirable output:</strong>
  <br /></p>
  
  <p><a href="https://i.stack.imgur.com/imULp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/imULp.png" alt="enter image description here"></a></p>