Using plotnine in Power BI
The plots returned by plotnine have a data type specific to the package used. Assuming you have assigned a plotnine plot to the variable p
, this is what you get:
Figure 20.6: Data type of a plotnine plot
As you probably remember, by default, the graphs handled in Python script are of the Matplotlib plot type. Also, If you consult Microsoft’s documentation on the Python packages installed in the Python engine of the Power BI service as of the time of writing (https://bit.ly/powerbi-python-limits), the plotnine package is not among them. So, how can you take advantage of the full potential of plotnine if the package does not seem to be installed on the service? You have three options. Let’s see what they are.
Working with plotnine and getting an image
One of the most immediate options is to use the string of the binary representation of the plot image generated by plotnine, as briefly mentioned in the Univariate exploration...