Open Side Menu
Skip to contentBrand Logo
Forums
Inspiration
Ideas
Communities
Blogs
Learning
Support
RegisterSign In
  1. Microsoft Fabric Community
  2. Power BI forums
  3. Galleries
  4. R Script Showcase
Sharon's avatar
Sharon
Microsoft Employee
10 years ago

Correlation Plot

  Description Correlation plots can be used to quickly find insights, showing what otherwise would require lots of iterative slicing and dicing of your data. Download this sample to see how...
Correlation Plot Showcase.pbix470 KB
ScriptInstallPackagesWithWorkaroundsCorrplot.R1 KB
Advanced Analytics Visualizations
ironryan77's avatar
ironryan77
Kudo Commander
9 years ago

I love what you did here with this visual and it works perfectly in my PowerBI Desktop.  However, when I try to view this from Power BI intranet, I get this error.  I have tried to correct this by modifying the function and corrplot lines of code, with no success:

#verify if the column is numeric and non-constant
correctColumn <- function(someColumn) { !is.null(someColumn) && is.numeric(someColumn) && length(unique(someColumn)) > 1 }
corrplot(M, method=method, order=order, type=type, addrect=addrect, #na.label = "?",
na.rm=TRUE, 
          mar = defMar, tl.col = tl.col, tl.cex=tl.cex,  tl.srt=60, cl.ratio=0.2, cl.align="r",  
       number.digits=number.digits, number.cex=number.cex, addCoef.col=addCoef.col)

How can I fix this?

 

boefraty's avatar
boefraty
Microsoft Employee
9 years ago

Hi  ironryan77, 

Can you please share with me the PBIX, so I'd be able to reproduce this error?  

  • ironryan77's avatar
    ironryan77
    Kudo Commander
    9 years ago

    Thanks, but I think I got this working now!

  • ironryan77's avatar
    ironryan77
    Kudo Commander
    9 years ago
    1. How does corrplot calculate correlation matrices?
    2. Is this based on Pearson’s correlation coefficient formula? When I try plugging in my values to this formula, they do not match.
    3. Does corrplot remove duplicate rows?
    4. Does it handle aggregated columns?
    • Mike_Carlo's avatar
      Mike_Carlo
      Most Valuable Professional
      9 years ago

      Here is the documentation on the corrplot function that was used. 

       

      https://cran.r-project.org/web/packages/corrplot/corrplot.pdf

      • JaouadZrhibi's avatar
        JaouadZrhibi
        Helper I
        8 years ago

        Hi,

         

        After reading your nice posts, I need some help.

         

        (Sorry, I m beginner on Power BI).

         

        https://app.powerbi.com/view?r=eyJrIjoiNGNjYWEyMDItMmVhYS00OTVmLTgxM2ItYjFmMjYyODVmMDU5IiwidCI6IjBiOWI3NWE3LTk0MTQtNDg0Ny05NjBkLWRiN2YxNzgyMjk2ZSIsImMiOjl9

         

         

        I would like to build graphs or indicators in order to see correlations between countries in import trade according 2 variables : weights in TON and volumes in USD.

         

         

        I added this code but it doesn't work : 

         

        require("corrplot")
        library(corrplot)

        M <- cor(dataset)

        corrplot(M, method = "circle", tl.cex=0.6, tl.srt = 45, tl.col = "black", type= "upper", order="hclust")

         

         

         

        If you have any suggestions, please advise.

         

        Thank you in advance for your time and help,

         

        Jaouad

        Example_Mattress imports trade statistics.pbix1 MB
  • © 2026 Microsoft
  • Manage cookies
  • Privacy & cookies
  • Terms of use
  • Trademarks
Your Privacy Choices Consumer Health Privacy