<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python in Power BI - Set background colour for matplotlib box plot in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Python-in-Power-BI-Set-background-colour-for-matplotlib-box-plot/m-p/670581#M19132</link>
    <description>&lt;P&gt;I am plotting a box plot using Python in Power BI. I have set the background colour of the Power BI report page to yellow and am trying to set the background colour of the python visual. I have the following code currently.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;matplotlib.rc('axes', facecolor = 'red')
dataset.boxplot(column='daily_return', by='name', grid=False, figsize=(15,4))
matplotlib.pyplot.title('')
matplotlib.pyplot.suptitle('')
matplotlib.pyplot.xlabel('')
matplotlib.pyplot.show()&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;The above code results in the following picture...&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;IMG src="https://ip1.i.lithium.com/dc11671dfd564ef4902265f0a29fc42b8bd9d147/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f53775151712e706e67" border="0" alt="" width="782" height="235" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;As can be seen, there is still some white space. How do I get that to be red, which I will eventually change to my Power BI background colour.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If I can make the background transparent though, that'd be best&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I even tried the following to no avail.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;fig = matplotlib.pyplot.figure()
fig.patch.set_facecolor('blue')
fig.patch.set_alpha(1)&lt;/PRE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 16 Apr 2019 03:02:03 GMT</pubDate>
    <dc:creator>dpc_development</dc:creator>
    <dc:date>2019-04-16T03:02:03Z</dc:date>
    <item>
      <title>Python in Power BI - Set background colour for matplotlib box plot</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Python-in-Power-BI-Set-background-colour-for-matplotlib-box-plot/m-p/670581#M19132</link>
      <description>&lt;P&gt;I am plotting a box plot using Python in Power BI. I have set the background colour of the Power BI report page to yellow and am trying to set the background colour of the python visual. I have the following code currently.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;matplotlib.rc('axes', facecolor = 'red')
dataset.boxplot(column='daily_return', by='name', grid=False, figsize=(15,4))
matplotlib.pyplot.title('')
matplotlib.pyplot.suptitle('')
matplotlib.pyplot.xlabel('')
matplotlib.pyplot.show()&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;The above code results in the following picture...&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;IMG src="https://ip1.i.lithium.com/dc11671dfd564ef4902265f0a29fc42b8bd9d147/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f53775151712e706e67" border="0" alt="" width="782" height="235" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;As can be seen, there is still some white space. How do I get that to be red, which I will eventually change to my Power BI background colour.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If I can make the background transparent though, that'd be best&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I even tried the following to no avail.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;fig = matplotlib.pyplot.figure()
fig.patch.set_facecolor('blue')
fig.patch.set_alpha(1)&lt;/PRE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 16 Apr 2019 03:02:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Python-in-Power-BI-Set-background-colour-for-matplotlib-box-plot/m-p/670581#M19132</guid>
      <dc:creator>dpc_development</dc:creator>
      <dc:date>2019-04-16T03:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Python in Power BI - Set background colour for matplotlib box plot</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Python-in-Power-BI-Set-background-colour-for-matplotlib-box-plot/m-p/685489#M19330</link>
      <description>&lt;P&gt;I'm having the exact same issue!&amp;nbsp; I am putting together a demo for my team, and I would like to make the "sky" blue, but cannot for the life of me figure out how to turn the white boarder blue (or transparent as OP stated.)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rainbow - Power BI Desktop.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/162942i034EA9980F4B0C85/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rainbow - Power BI Desktop.png" alt="Rainbow - Power BI Desktop.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have tried setting the figure facecolor and edgecolor to blue:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;fig1 = plt.figure(1,facecolor='#7ec0ee', edgecolor='#7ec0ee')&amp;nbsp; &amp;lt;- This did nothing&lt;/P&gt;&lt;P&gt;ax = fig1.add_subplot(1,1,1)&lt;/P&gt;&lt;P&gt;ax.set_facecolor('#7ec0ee') &amp;lt;- this worked&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These seem to work in Spyder, but when I put the visual into Power BI the white boarder appears.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2Spyder - Rainbow.png" style="width: 441px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/162943i745F3964FB196095/image-size/large?v=v2&amp;amp;px=999" role="button" title="2Spyder - Rainbow.png" alt="2Spyder - Rainbow.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 13:02:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Python-in-Power-BI-Set-background-colour-for-matplotlib-box-plot/m-p/685489#M19330</guid>
      <dc:creator>lvcoffman</dc:creator>
      <dc:date>2019-05-07T13:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Python in Power BI - Set background colour for matplotlib box plot</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Python-in-Power-BI-Set-background-colour-for-matplotlib-box-plot/m-p/3019265#M40711</link>
      <description>&lt;P&gt;Set the default matplotlib saving option to transperent like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import maplotlib
matplotlib.rc('savefig', transperent=True)&lt;/LI-CODE&gt;&lt;P&gt;This worked for me.&lt;/P&gt;&lt;P&gt;I got this answer from this&amp;nbsp;&lt;A title="post" href="https://stackoverflow.com/a/55746288/6819442" target="_self"&gt;https://stackoverflow.com/a/55746288/6819442&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 12:42:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Python-in-Power-BI-Set-background-colour-for-matplotlib-box-plot/m-p/3019265#M40711</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-13T12:42:53Z</dc:date>
    </item>
  </channel>
</rss>

