1
votes

Python dans Power BI - Définir la couleur d'arrière-plan du box plot matplotlib

Je trace une boîte à moustaches à l'aide de Python dans Power BI. J'ai défini la couleur d'arrière-plan de la page de rapport Power BI sur jaune et j'essaie de définir la couleur d'arrière-plan du visuel python. J'ai actuellement le code suivant.

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()

Le code ci-dessus donne l'image suivante ... sortie python

Comme on peut le voir, il y a encore un espace blanc. Comment faire pour que cela devienne rouge, que je changerai éventuellement en couleur d'arrière-plan Power BI.

Si je peux rendre l'arrière-plan transparent, ce serait mieux .


0 commentaires

3 Réponses :


0
votes
plt.rcParams['figure.facecolor'] = 'Red'
It will make the same color for complete fig.

0 commentaires

2
votes

Ce qui suit a fonctionné ...

matplotlib.rc('savefig', transparent = True)


0 commentaires

0
votes
plt.rcParams['savefig.facecolor'] = 'grey'
Debbuged all parms and seen that Power Bi was displaying the rendered image then the live one.

0 commentaires