Home > Net >  Matplotlib how to increase the width of y-axis data?
Matplotlib how to increase the width of y-axis data?

Time:10-01

I was trying to display all the y-axis data, however you can see the value is being hidden bacause the width is too narrow. How to solve this problem?

enter image description here

x, y = zip(*freq_bi.most_common(n=10))
        plt.figure(figsize=(12, 5))
        plt.barh(range(len(x)), y, color='Maroon')
        y_pos = np.arange(len(x))
        plt.yticks(y_pos, x)
        plt.title('Frequency Count of Top 10 Bi-Grams', size=30)
        plt.ylabel('Frequent Words')
        plt.xlabel('Count')
        plt.savefig('Most Frequent 10 Bi-Grams.jpeg')

CodePudding user response:

enter image description here

CodePudding user response:

Maybe try changing the plt.figure() line.

plt.figure(figsize=(12, 5)) #Figure size x-axis and y-axis

If you change the two last numbers 12 and 5 and make them bigger it may make the graph larger, hope this helps.

  • Related