1

I have the following dictionary:

x = {'Benchmark': {'credit': -1.19,
  'dividend': 0.95,
  'fi_hy': 1.67,
  'fi_ig': 1.0,
  'growth': 0.9,
  'large-cap': 1.0,
  'mid-cap': 0.79,
  'small-cap': 0.63,
  'momentum': 0.9,
  'quality': 0.99,
  'total market': 0.98,
  'value': 0.97,
  'volatility': 1.16},
 'Portfolio': {'credit': -1.2434,
  'dividend': 1.0128000000000001,
  'fi_hy': 1.8062999999999998,
  'fi_ig': 0.868,
  'growth': 0.9530000000000001,
  'large-cap': 1.0441000000000003,
  'mid-cap': 0.8832,
  'small-cap': 0.7126,
  'momentum': 0.9372,
  'quality': 1.0342000000000002,
  'total market': 1.0383,
  'value': 1.0238,
  'volatility': 1.1582}}

i converted the dictionary to a dataframe and plotted the result:

fig, ax = plt.subplots(figsize=figsize)
df = pd.DataFrame(x)
df.plot(kind='bar', ax=ax,color=['#0574A0','#FF5233'], rot=35)

enter image description here

All good. However, i want to be able to get the label correct where "credit" the letter "t" ends on the first line. "dividend" the letter "d" ends on 2nd line etc. How do i do this here? Thanks

turtle_in_mind
  • 986
  • 1
  • 18
  • 36

0 Answers0