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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.