Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

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.

flowie_0-1672320021766.png

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 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try to use figsize=(x,y) or set_figheight(), set_figwidth() to change the size of your Plot.

Besides, Python visuals in Power BI Desktop have the some limitations

Especially all Python visuals display at 72 DPI resolution. Maybe you need to change the DPI of your plot.

 

For more details, please refer to:

How to Change Plot and Figure Size in Matplotlib • datagy

Create Power BI visuals using Python in Power BI Desktop - Power BI | Microsoft Learn

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try to use figsize=(x,y) or set_figheight(), set_figwidth() to change the size of your Plot.

Besides, Python visuals in Power BI Desktop have the some limitations

Especially all Python visuals display at 72 DPI resolution. Maybe you need to change the DPI of your plot.

 

For more details, please refer to:

How to Change Plot and Figure Size in Matplotlib • datagy

Create Power BI visuals using Python in Power BI Desktop - Power BI | Microsoft Learn

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.