Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Matplotlib Dataframe Plot Size Issue

Hi,

 

I'm currently using matplotlib to plot some dataframes with Python Visual. The problem is that the dataframe is hard to read when you have more than 4 columns and I'm unable to make the font size bigger or expand the visualization more. Is there any way that I can make this table bigger? It seems there is a lot of whitespace in the horizontal and vertical axis.

Here is my code:

 

fig, ax = plt.subplots()
ax.set_axis_off()
table = ax.table(
    cellText = df.values,
    rowLabels = df.index,
    rowLoc = 'left',
    colLabels = df.columns,
    cellLoc ='center',  
    loc ='upper left')        
   
fig.tight_layout()
plt.show()

1 Reply