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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
chikaae
Frequent Visitor

Creating Python Visuals

Hi,

 

Hoping someone can help me.

 

I'm trying to create a custom Python visual (ridge plot) using the following fields :

(The Compliance (data type: Text) and Assignment Number (data type: Text)  fields are from 2 different tables)

# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script:

dataset = pandas.DataFrame(Compliance, Assignment Number)
dataset = dataset.drop_duplicates()
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd

# Paste or type your script code here:
ridge_plot = sns.FacetGrid(dataset, row="Compliance", hue="Compliance", aspect=5, height=1.25)
# Use map function to make density plot in each element of the grid.
ridge_plot.map(sns.kdeplot, "Assignment Number", clip_on=False, shade=True, alpha=0.7, lw=4, bw_method=.2)
ridge_plot.map(plt.axhline, y=0, lw=4, clip_on=False)
ridge_plot.savefig("Ridge_plot.png")
 
When I try to create the visual, I get the below error:
 
chikaae_1-1651746047238.png

I have two questions:

 

Can I create a dataset, for my Python custom visual, from 2 tables that have a one-many relationship ?

 

Also do you know why I'm getting the above error ?

 

Many thanks

 

Also do you know why I'm getting the above error ?

1 REPLY 1
plaralema
Advocate III
Advocate III

Hi, can you create your visual in a jupyter notebook, or visual code? 

do you have a drawing of the plot you want to make? I don't get it 

 

i have a ridgeplot but in R, that i use in PowerBi , although data is from same dataframe

 

It takes dates and a value, and month for y.axis . Color is a scale gradiente with value as input

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.