skip to main content
Power BI
    • What is Power BI
    • Why Power BI
    • Customer stories
    • Data visuals
    • Security
    • Power BI Desktop
    • Power BI Pro
    • Power BI Premium
    • Power BI Mobile
    • Power BI Embedded
    • Power BI Report Server
  • Pricing
    • Azure + Power BI
    • Microsoft 365 + Power BI
    • Dynamics 365 + Power BI
      • Energy
      • Healthcare
      • Manufacturing
      • Media
      • Retail
    • For analysts
    • For IT
      • Overview
      • Embedded analytics
      • Power BI visuals
      • Automation
      • Documentation
      • Community
    • Partners Overview
    • Solutions Partners
    • BI Specialized Partners
    • Power BI CSOs
    • Fabric Partner Community
    • Training
    • Getting started
      • Overview
      • Self-guided learning
      • Webinars
      • Documentation
      • Roadmap
      • Overview
      • Issues
      • Give feedback
    • Blog
    • Business intelligence topics
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • Events
    • User groups
    • Community blog
    • Register
    • ·
    • Sign in
    • ·
    • Help
    Go To
    • Power BI forums
    • Updates
    • News & Announcements
    • Get Help with Power BI
    • Desktop
    • Service
    • Report Server
    • Power Query
    • Mobile Apps
    • Developer
    • DAX Commands and Tips
    • Custom Visuals Development Discussion
    • Health and Life Sciences
    • Power BI Spanish forums
    • Translated Spanish Desktop
    • Power Platform Integration - Better Together!
    • Power Platform Integrations
    • Power Platform and Dynamics 365 Integrations
    • Training and Consulting
    • Instructor Led Training
    • Galleries
    • Community Connections & How-To Videos
    • COVID-19 Data Stories Gallery
    • Themes Gallery
    • Data Stories Gallery
    • R Script Showcase
    • Webinars and Video Gallery
    • Quick Measures Gallery
    • 2021 MSBizAppsSummit Gallery
    • 2020 MSBizAppsSummit Gallery
    • 2019 MSBizAppsSummit Gallery
    • Events
    • Ideas
    • Custom Visuals Ideas
    • Issues
    • Issues
    • Events
    • Upcoming Events
    • Community Engagement
    • T-Shirt Design Challenge 2023
    • Community Blog
    • Power BI Community Blog
    • Custom Visuals Community Blog
    • Community Support
    • Community Accounts & Registration
    • Using the Community
    • Community Feedback
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 

    Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

    • Power BI forums
    • Galleries
    • R Script Showcase
    • Re: Correlation Plot

    Re: Correlation Plot

    02-27-2019 11:35 AM

    Super User smpa01
    Super User
    35478 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    Sharon
    Microsoft Sharon
    Microsoft
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    Correlation Plot

    ‎08-14-2016 06:15 AM

     

    report_corrplot.JPGDescription

    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 a correlation plot can inform marketing strategies in different market segments.

     

    Prerequisites (The sample .pbix files will not work without these prerequites completed)

    1. Install R Engine

    Power BI Desktop does not include, deploy or install the R engine. To run R scripts in Power BI Desktop, you must separately install R on your local computer. You can download and install R for free from many locations, including the Revolution Open download page, and the CRAN Repository.

     

    2. Install the required R packages.

    Download the R script attached to this message and run it to install all required packages on your local machine. 

     

    Required R packages:

    corrplot

     

    Tested on:

    CRAN 3.3.1, MRO 3.3.0, powerbi.com

     

    Legal Disclaimers:

    Terms of Service and Third Party Programs.

     

    Preview file
    5 KB
    Correlation Plot Showcase.pbix
    ScriptInstallPackagesWithWorkaroundsCorrplot.R
    Labels:
    • Labels:
    • Advanced Analytics Visualizations
    Message 1 of 17
    80,130 Views
    10
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic
    Katalo
    Katalo
    Frequent Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎09-18-2018 07:10 AM

    Hello!

    I'm new to R visuals in Power BI. But I've installed Microsoft R Open 3.5.1 and the visual in the example. But when I insert values the visual gives ni this error:

     

    Error Message:
    R script error.
    Loading required package: corrplot
    Warning messages:
    1: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
    there is no package called 'corrplot'
    2: In libraryRequireInstall("corrplot") :
    *** The package: 'corrplot' was not installed ***
    Error in corrplot(M, method = method, order = order, type = type, addrect = addrect, :
    could not find function "corrplot"
    Execution halted

     

    What am I missing here?

    Message 13 of 17
    35,706 Views
    0
    Reply
    smpa01
    Super User smpa01
    Super User
    In response to Katalo
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎02-27-2019 11:35 AM

    @Kataloprobably you figured it out by now. If not, I am not sure if the following steps solve your problem but this is my two cents. Initially, I faced a lot of trouble with R (got the similar message as you did). After a long trial and error and knocking on many doors I solved it by using the following

     

    When I run R in PBI, the packages are accessed by PBI from C:\Users\xxxx\Library.

     

    However, when I install the packages from R studio, the installed packages get saved in C:\Users\xxxx\Documents\R\win-library\3.5.

     

    After installing a package, I copy that package

    from

    C:\Users\xxxx\Documents\R\win-library\3.5

    to

    C:\Users\xxxx\Library

     

    Everything seems to work fine after that.





    Did I answer your question? Mark my post as a solution!

    Proud to be a Super User!






    New Animated Dashboard: Sales Calendar


    Message 17 of 17
    35,478 Views
    1
    Reply
    JaouadZrhibi
    JaouadZrhibi Helper I
    Helper I
    In response to Katalo
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎09-20-2018 09:32 AM

    Hi Katalo,

     

    I m really sorry, I am also a beginner in Power BI.

     

    Hope you will find the solution.

     

    Regards,

     

    Jaouad

    Message 14 of 17
    35,695 Views
    1
    Reply
    boefraty
    Microsoft boefraty
    Microsoft
    In response to JaouadZrhibi
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎09-25-2018 01:40 AM

    Hi @JaouadZrhibi and @Katalo, 

     

    Run

    install.packages("corrplot")

     

    from any R console. You can also download script provided with sample 
    https://community.powerbi.com/oxcrx34285/attachments/oxcrx34285/RVisuals/12/16/ScriptInstallPackages...

    Unfortunatly, if you use R Visual, power BI can not handle automatic package install. 

    In case of R Custom Visual 
    https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA104380814?tab=Overview

     

    It is installed automatically 

     

    Message 15 of 17
    35,680 Views
    2
    Reply
    Mike_Carlo
    Mike_Carlo
    MVP
    In response to boefraty
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎09-25-2018 10:15 AM

    The local installation of your R will need to include the "corrplot" package.  as boefraty stated below you can use the following code to install it. 

     

    install.packages("corrplot")

    You should run that in your local installation of R.  

     

    Follow this tutorial to help you install thie package "corrplot" 

    https://powerbi.tips/2016/09/using-r-visuals-in-power-bi/

     

     

    Mike Carlo ( https://powerbi.tips )
    mike@PowerBI.Tips
    Message 16 of 17
    35,675 Views
    0
    Reply
    Anonymous
    Not applicable
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-12-2018 02:58 PM

    For a while now, I am experiencing a problem with Correlation plot.

     

    As I am using the same file sample with the same data and the same fields, but now importing the Correlation Plot visual from the visual market, I tried to replicate the same analysis, however, I always have the same error:

     

    "Some columns are not numeric, or constant. Not enough input dimensions"

     

    I have all the packages installed, everything, but always the same error, even if I type the code at the R script.

     

    Any help with this?

     

    Thank you in advance

    Correlation Plot Showcase.pbix
    Message 11 of 17
    65,722 Views
    0
    Reply
    boefraty
    Microsoft boefraty
    Microsoft
    In response to Anonymous
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-29-2018 05:55 AM

    Hi @Anonymous, 

    Make sure the columns are not aggregated. 

    Capture.PNG

    Message 12 of 17
    35,749 Views
    2
    Reply
    ironryan77
    ironryan77 Advocate II
    Advocate II
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎04-07-2017 01:21 PM

    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?

     

    correlation script runtime error.jpg

    Message 4 of 17
    76,241 Views
    0
    Reply
    boefraty
    Microsoft boefraty
    Microsoft
    In response to ironryan77
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎04-23-2017 12:39 AM

    Hi  ironryan77, 

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

    Message 5 of 17
    75,971 Views
    1
    Reply
    ironryan77
    ironryan77 Advocate II
    Advocate II
    In response to boefraty
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎04-27-2017 08:06 AM
    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?
    Message 7 of 17
    75,879 Views
    0
    Reply
    Mike_Carlo
    Mike_Carlo
    MVP
    In response to ironryan77
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎04-27-2017 09:46 AM

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

     

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

    Mike Carlo ( https://powerbi.tips )
    mike@PowerBI.Tips
    Message 8 of 17
    75,871 Views
    1
    Reply
    JaouadZrhibi
    JaouadZrhibi Helper I
    Helper I
    In response to Mike_Carlo
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎06-07-2018 08:04 AM

    Hi,

     

    After reading your nice posts, I need some help.

     

    (Sorry, I m beginner on Power BI).

     

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

     

     

    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.pbix
    Message 9 of 17
    66,644 Views
    1
    Reply
    boefraty
    Microsoft boefraty
    Microsoft
    In response to JaouadZrhibi
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-29-2018 06:12 AM

    Hi @JaouadZrhibi, 

    Your code is almost perfect just di right-click on your data clumns and select  "Don't summarize" 

    Message 10 of 17
    35,747 Views
    0
    Reply
    ironryan77
    ironryan77 Advocate II
    Advocate II
    In response to boefraty
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎04-24-2017 02:13 PM

    Thanks, but I think I got this working now!

    Message 6 of 17
    75,951 Views
    0
    Reply
    Mike_Carlo
    Mike_Carlo
    MVP
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎09-14-2016 10:51 PM

    This is a great R visual.  I have taken some time to build a complete tutorial on how to 1. Install R, 2. add R code to PowerBI, 3. Manipulate the code to change the visual.  You can follow along and learn how to build this here (www.PowerBI.Tips).

     

    Enjoy,

    Mike

    Mike Carlo ( https://powerbi.tips )
    mike@PowerBI.Tips
    Message 2 of 17
    78,663 Views
    6
    Reply
    boefraty
    Microsoft boefraty
    Microsoft
    In response to Mike_Carlo
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎11-22-2016 01:44 AM

    Great tutorial ! Here is another useful resource: https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-r-powered-custom-visuals/#troubles...

     

    Message 3 of 17
    77,871 Views
    0
    Reply

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Pages
    • Power Automate
    • Power Virtual Agents

    • Sign in
    • Sign up

    Browse

    • Solutions
    • Partners
    • Consulting Services

    Downloads

    • Power BI Desktop
    • Power BI Mobile
    • Power BI Report Server
    • See all downloads

    Learn

    • Guided learning
    • Documentation
    • Support
    • Community
    • Give feedback
    • Webinars
    • Developers
    • Blog
    • Newsletter

    © 2023 Microsoft

    Follow Power BI

    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Trademarks
    Consumer Privacy Act (CCPA) Opt-Out Icon Your Privacy Choices