1

I have a Python custom visual inside a PowerBI report. Normally, this automatically fills the available space - and set the aspect ratio accordingly. However, when I set a facecolor background color (say None for a transparent visual, but also any other color), then the visual does not fill the space anymore, just keep the default matplotlib aspect ratio. Any ideas on how to force the chart to autofill?

This renders correctly with autofill:

import matplotlib.pyplot as plt
plt.plot(dataset['Column1'],dataset['Column2'])
plt.show()

enter image description here

But this has the aspect ratio problem:

import matplotlib.pyplot as plt
plt.figure(facecolor='red')
plt.plot(dataset['Column1'],dataset['Column2'])
plt.show()

enter image description here

Davide Bacci
  • 16,647
  • 3
  • 10
  • 36
csaladenes
  • 1,100
  • 1
  • 11
  • 27
  • Can I ask a mod to add `powerbi-python-visual` as a tag? `python-visual` seems to be relating also to the `visual` library in python, which makes it ambiguous. Let's also rename that `python-visual-library` or so. – csaladenes Feb 10 '23 at 14:45
  • 1
    I have created the new tag for you. – Davide Bacci Feb 10 '23 at 14:54

0 Answers0