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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
William29
Helper I
Helper I

Remove padding around python visual

When I create plot using a python visualization in powerBi it looks like this:

 

William29_0-1663465932376.png

 

 

Notice that the image is not as wide as it could be as there appears to be padding on the left and right of the image. I am wanting to know how to get rid of this padding and make the image span the entire width.

 

The relevant part of the code is:

 

William29_4-1663467251292.png

 

 

 

 

 You will notice that I have already tried increasing the figure size through figure(figsize=(100,10)) and have used tight_layout to attempt to get rid of the width-related-padding without success (note that tight-layout successfully gets rid of the height related padding).  If you know how to get rid of this width-related padding I would much appreciate it.

 

Note that figure(figsize=(x,y)) is operating strangely and sometimes increasing the values of x, y decreases the size of the image. It only does this in powerBI, it doesnt do this if I run the python script within python (rather than within a python visualization script within powerBi). I manage to get the image as big as possible with x=60, y=30 but it is still not wide enough. It appears to make the image slightly wider if I use x=50, and y=30 (strange i know, as x is smaller) but part of the title goes into the padding and cutout. I feel it is almost lile it is using the values of x,y to set the proportions of the image rather than the size, and it is attempting to fit the largest image within those proportions

that can fit into the space (but even this is not quite right, so I dont really know what it is doing.

 

Here is the link to the report:

 

https://drive.google.com/file/d/1OEjBMUAeyDn_cceigDgNJGnO21QIUH8V/view?usp=sharing

 

 

 

3 REPLIES 3
lbendlin
Super User
Super User

This came up recently in this forum. You can solve it be using subplots and playing with the aspect ratio.  Note that you cannot really predict what screen geometry will be used by the report consumers.

@lbendlinDid this come up in a question on this forum? Are you able to give me a link to the question?

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.