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.

Correlation Plot in Deneb

Does anyone know where I can find the code to create the correlation graph which was on the store in R and which is no longer there? In Vega or Vega lite for Deneb? Thank  you so much. 

a38b34b5-4464-4c9e-9e1c-90f8fa64d77f.png

 

Status: Investigating

Hi @JimmyCruyp ,

 

I wonder if this will help you:

GitHub - deneb-viz/deneb: Deneb is a custom visual for Microsoft Power BI, which allows developers t...

 

Glad to see that if you provide details, giammariam can give you help. (Please be careful to hide sensitive information since this is an open forum) 

 

Best Regards,
Community Support Team _ Caitlyn

Comments
giammariam
Super User

Hey @JimmyCruyp, if you could provide some sample data (here's how), I'd be happy to give this a shot.

v-xiaoyan-msft
Community Support
Status changed to: Investigating

Hi @JimmyCruyp ,

 

I wonder if this will help you:

GitHub - deneb-viz/deneb: Deneb is a custom visual for Microsoft Power BI, which allows developers t...

 

Glad to see that if you provide details, giammariam can give you help. (Please be careful to hide sensitive information since this is an open forum) 

 

Best Regards,
Community Support Team _ Caitlyn

JimmyCruyp
Helper II

Hey @giammariam (this is usd compair to other currency). Just a sample of data : 

Country Year Rates AUS 2019 1,44 AUS 2020 1,45 AUS 2021 1,33 AUS 2022 1,44 CAN 2019 1,33 CAN 2020 1,34 CAN 2021 1,25 CAN 2022 1,3 CZE 2019 22,93 CZE 2020 23,21 CZE 2021 21,68 CZE 2022 23,36 FIN 2019 0,89 FIN 2020 0,88 FIN 2021 0,85 FIN 2022 0,95 DEU 2019 0,89 DEU 2020 0,88 DEU 2021 0,85 DEU 2022 0,95 IRL 2019 0,89 IRL 2020 0,88 IRL 2021 0,85 IRL 2022 0,95 JPN 2019 109,01 JPN 2020 106,77 JPN 2021 109,75 JPN 2022 131,5 MEX 2019 19,26 MEX 2020 21,49 MEX 2021 20,27 MEX 2022 20,13 NZL 2019 1,52 NZL 2020 1,54 NZL 2021 1,41 NZL 2022 1,58 NOR 2019 8,8 NOR 2020 9,42 NOR 2021 8,59 NOR 2022 9,61 SVK 2019 0,89 SVK 2020 0,88 SVK 2021 0,85 SVK 2022 0,95 SWE 2019 9,46 SWE 2020 9,21 SWE 2021 8,58 SWE 2022 10,11 CHE 2019 0,99 CHE 2020 0,94 CHE 2021 0,91 CHE 2022 0,95 TUR 2019 5,67 TUR 2020 7,01 TUR 2021 8,85 GBR 2019 0,78 GBR 2020 0,78 GBR 2021 0,73 GBR 2022 0,81 CHN 2019 6,91 CHN 2020 6,9 CHN 2021 6,45 CHN 2022 6,74 EST 2019 0,89 EST 2020 0,88 EST 2021 0,85 EST 2022 0,95 IND 2019 70,42 IND 2020 74,1 IND 2021 73,92 IND 2022 78,6 ISR 2019 3,56 ISR 2020 3,44 ISR 2021 3,23 ISR 2022 3,36 RUS 2019 64,74 RUS 2020 72,1 RUS 2021 73,65 ZAF 2019 14,45 ZAF 2020 16,46 ZAF 2021 14,78 ZAF 2022 16,36 LVA 2019 0,89 LVA 2020 0,88 LVA 2021 0,85 LVA 2022 0,95 LTU 2019 0,89 LTU 2020 0,88 LTU 2021 0,85 LTU 2022 0,95 SAU 2019 3,75 SAU 2020 3,75 SAU 2021 3,75 SAU 2022 3,75 EA19 2019 0,89 EA19 2020 0,88 EA19 2021 0,85 EA19 2022 0,95 CRI 2019 587,29 CRI 2020 584,9 CRI 2021 620,78 CRI 2022 647,14 BGR 2019 1,75 BGR 2020 1,72 BGR 2021 1,65 BGR 2022 1,86 HRV 2019 6,62 HRV 2020 6,61 HRV 2021 6,36 HRV 2022 0,95 CYP 2019 0,89 CYP 2020 0,88 CYP 2021 0,85 CYP 2022 0,95 MLT 2019 0,89 MLT 2020 0,88 MLT 2021 0,85 MLT 2022 0,95 MKD 2019 54,95 MKD 2020 54,14 MKD 2021 52,1 MKD 2022 58,57 MDG 2019 3618,32 MDG 2020 3787,75 MDG 2021 3829,98 MDG 2022 4096,12 MAR 2019 9,62 MAR 2020 9,5 MAR 2021 8,99 MAR 2022 10,16 ZMB 2019 12,89 ZMB 2020 18,34 ZMB 2021 20,02 ZMB 2022 16,96 HKG 2019 7,84 HKG 2020 7,76 HKG 2021 7,77 HKG 2022 7,83 EU27_2020 2019 0,89 EU27_2020 2020 0,88 EU27_2020 2021 0,85 EU27_2020 2022 0,95 GEO 2019 2,82 GEO 2020 3,11 GEO 2021 3,22 GEO 2022 2,92 CMR 2019 585,91 CMR 2020 575,59 CMR 2021 554,53 CMR 2022 623,76 SEN 2019 585,91 SEN 2020 575,59 SEN 2021 554,53 SEN 2022 623,76

giammariam
Super User

@JimmyCruyp, thanks for the data that you provided. So, creating the viz in Deneb shouldn't actually be hard. What I'm having trouble with is calculating the values (correlation coefficient?) in the cells that are encoded as text and circles. I was able to calculate the correlation coefficient for the entire dataset. Admittedly I'm not great with statistics (something that I need to work on), so any insight into the formula for calculating the value for an individual cell would be greatly appreciated. Everything I'm finding is just instructions on how to create the chart in r. 

giammariam_0-1677354041327.png

 

JimmyCruyp
Helper II

@giammariam Hi, thanks a lot for your support. I really dont know. Have you tried to ask "Chat GPT"? Maybe he could support? At least for the understanding on the formula for calculation?

giammariam
Super User

@JimmyCruyp, great idea. I'll try that and continue researching.

giammariam
Super User

@JimmyCruyp, I finally found some time to get back at this. I actually found a really great guide by Parker Stevens on how to create a correlation plot with native visuals only.
Screenshot from guide:

giammariam_0-1678066054463.png

I then took his concept and incorporated DAX generated SVGs to include the circles and the values. 

Here's the screenshot after my updates:

giammariam_1-1678066154192.png

 

Let me know if this is enough to get you going or if you have any thoughts.

 

You can download the .pbix here.

JimmyCruyp
Helper II

@giammariam This looks amazing! thank you very much.

If I understand well, I just have to change the data source in the cars tabe an I will have the same result. Index could be a year column for example.

 

giammariam
Super User

Hey @JimmyCruyp. Cool glad it will work. 

So here are the things you'll want to change:

  • Power Query:
    • In the example, all queries are reference queries (besides _measures and Cars), with the base query being Cars
    • In your source data, if you have the variables in key-value pairs already, you wouldn't need the Cars query; you'd be starting with a query that looks like Cars Pivot.
    • If you have your variables as columns (like in the initial Cars query), then you'd flatten the values into key-value pairs, as was done in the Cars Pivot
    • Attributes, Attribues1, and Attributes2  are all single-column queries that just contain a unique list of the variables. One is for the x-axis of the matrix, and the other is for the y-axis. 
      • The Attributes query is the bridge between Attributes1 and Attributes2, and is used to populate the slicer
      • Note - the cardinality and single cross filter direction are very important here
  • DAX
    • You'll want to modify the following measures to use your values (fortunately these measures are 99%" the same with the exception of how the return value is calculated):
      • n
      • X
      • Y
      • X^2
      • Y^2
      • XY
    • The only DAX variables that you'll want to make sure to change in the CC SVG measure are _w and _h to match the Image size formatting properties (see below screenshot)

giammariam_0-1678107897777.png

 

JimmyCruyp
Helper II

@giammariam 

this is great thanks a lot,

Could you please just explain me the meaning of the different measures? If we take my example with currency, normallly you have only one measure right? What are all these measures for? Could you explain for each? THanks a lot, Jim

  • n
  • X
  • Y
  • X^2
  • Y^2
  • XY