2

I have the following code:

import matplotlib.pyplot as plt 
import seaborn as sns
import pandas as pd
import os
import matplotlib.font_manager as font_manager
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl


path = os.getcwd() + "/results/"



sns.set_theme(style="whitegrid")
df = pd.read_csv("C:/tmp/all2.txt")  

 
ax = sns.boxplot(x="cluster", y="val",
            hue="type", palette=["k", "w"],
            data=df,showfliers = False)

#sns.despine(ax=ax, trim=True, offset={'left':1,'right':1,'top':1,'bottom':1})

ax.set(ylabel='Number', xlabel='Clustered profiles')




font = font_manager.FontProperties(family='sans-serif',
                                   weight='bold',
                                   style='normal')
plt.legend(loc='best', frameon=False, prop=font)


plt.legend(loc='best', frameon=False, prop=font)
plt.xticks(weight='bold', fontname='sans-serif')
plt.yticks(weight='bold', fontname='sans-serif')
plt.xlabel("Clustered profiles", weight='bold', fontname='sans-serif', size=14)



plt.tight_layout()
plt.savefig(path + "/myoutput.pdf", dpi=250, transparent=False,   bbox_inches='tight', format="pdf")

I'm getting following output:

enter image description here

I'm trying to enlarge my output because not all labels can be read; I'm unsure how to do it. I tried to use a higher dpi, but it didn't help me. What am I missing?

Cenk Ten
  • 283
  • 5
  • 20
  • 1
    You can increase the figsize, e.g. via calling `plt.figure(figsize=(16,6))` before creating the plot. – JohanC Oct 19 '21 at 08:07

1 Answers1

1

Thanks to @JohanC's comment, here is the solution;

plt.figure(figsize=(12,6))
Cenk Ten
  • 283
  • 5
  • 20