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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
CesarArenas
Frequent Visitor

Python padding doesn't work in Power BI Service

Hi all,

 

I am using python to built a boxplot graph. As you may know, padding in python is not that good so in order to improve my graph size I am using plt.tight_layout(). This works perfect in PBI Desktop but once I publish my report, the original padding comes back. 

 

This is my first work in power bi using python, Am I missing something?

 

Thanks,

 

Cesar

1 ACCEPTED SOLUTION

Hi Xiaoxin,

I found the solution, for boxplots instead of using plt.tight_layout() I needed to use plt.figure(figsize=(20,5)).

It is not a perfect option because there is still some non-optimized surrounding spaces, but at least it works with PBI services.

 

Regards,

 

Cesar

 

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @CesarArenas ,

I'd like to suggest you to take a look at following blog about power bi and python script:

Python visualizations in Power BI Service

Spoiler
The Python scripts in your reports are executed by the Power BI service in an isolated sandbox that restricts the access of the scripts to the network and the other machine resources. This ensures that your datasets and the Power BI service are not vulnerable to attacks.

As document said, all python script execute in a sandbox and power bi will block the access of extra resources. It may block some functions work on power bi service side.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi Xiaoxin,

I found the solution, for boxplots instead of using plt.tight_layout() I needed to use plt.figure(figsize=(20,5)).

It is not a perfect option because there is still some non-optimized surrounding spaces, but at least it works with PBI services.

 

Regards,

 

Cesar

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors