<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: R correlation plot visual in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/R-correlation-plot-visual/m-p/4008220#M53688</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/732475"&gt;@ChristianAU&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To change the color of the text within the red line to white in your R script visual, you need to adjust the text label color parameters in the corrplot function. Specifically, you need to make sure all text elements in the plot are set to white. Here’s the updated script:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Load necessary libraries
library(ggplot2)
library(reshape2)
library(corrplot)

# Ensure that the dataset is not empty
if(nrow(dataset) &amp;gt; 0) {
    # Compute the correlation matrix
    cor_matrix &amp;lt;- cor(dataset, use = "complete.obs")
    
    # Increase plot size and adjust margins for better readability
    par(mar = c(4, 4, 2, 2), oma = c(2, 2, 2, 2), mfrow = c(1, 1))
    options(repr.plot.width=10, repr.plot.height=8)
    
    # Define custom color palette
    custom_col &amp;lt;- colorRampPalette(c("#8B0000", "#FFD700", "#006400"))(200)
    
    # Set plot background color and text color
    par(bg = "#003165", col.lab = "white", col.axis = "white", col.main = "white", col.sub = "white")
    
    # Plot the correlation matrix using corrplot with custom settings
    corrplot(cor_matrix, method = "color", type = "upper", 
             tl.col = "white", tl.srt = 45, 
             addCoef.col = "white", number.cex = 0.7,
             col = custom_col,
             cl.cex = 1, cl.col = "white", cl.ratio = 0.2)
} else {
    plot.new()
    par(bg = "#003165")
    text(0.5, 0.5, "No data available", cex = 1.5, col = "white")
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hackcrr&lt;/P&gt;&lt;P&gt;If this post helps, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;kudos to this post&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jun 2024 05:03:00 GMT</pubDate>
    <dc:creator>hackcrr</dc:creator>
    <dc:date>2024-06-25T05:03:00Z</dc:date>
    <item>
      <title>R correlation plot visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/R-correlation-plot-visual/m-p/4006585#M53676</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;In the uploaded image under the code, I would like the black text marked within the red line to be white. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;I'm not sure how to write the code to address this issue. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;The code I've used to make the R script visual is:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;# Paste or type your script code here:&lt;/SPAN&gt;
&lt;SPAN class=""&gt;# Load necessary libraries&lt;/SPAN&gt;
library&lt;SPAN class=""&gt;(&lt;/SPAN&gt;ggplot2&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
library&lt;SPAN class=""&gt;(&lt;/SPAN&gt;reshape2&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
library&lt;SPAN class=""&gt;(&lt;/SPAN&gt;corrplot&lt;SPAN class=""&gt;)&lt;/SPAN&gt;

&lt;SPAN class=""&gt;# Ensure that the dataset is not empty&lt;/SPAN&gt;
&lt;SPAN class=""&gt;if&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;nrow&lt;SPAN class=""&gt;(&lt;/SPAN&gt;dataset&lt;SPAN class=""&gt;)&lt;/SPAN&gt; &lt;SPAN class=""&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;0&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt; &lt;SPAN class=""&gt;{&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;# Compute the correlation matrix&lt;/SPAN&gt;
    cor_matrix &lt;SPAN class=""&gt;&amp;lt;-&lt;/SPAN&gt; cor&lt;SPAN class=""&gt;(&lt;/SPAN&gt;dataset&lt;SPAN class=""&gt;,&lt;/SPAN&gt; use &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"complete.obs"&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
    
    &lt;SPAN class=""&gt;# Increase plot size and adjust margins for better readability&lt;/SPAN&gt;
    par&lt;SPAN class=""&gt;(&lt;/SPAN&gt;mar &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;c&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;4&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;4&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;2&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;2&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; oma &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;c&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;2&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;2&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;2&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;2&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; mfrow &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;c&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;1&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;1&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
    options&lt;SPAN class=""&gt;(&lt;/SPAN&gt;repr.plot.width&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;10&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; repr.plot.height&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;8&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
    
    &lt;SPAN class=""&gt;# Define custom color palette&lt;/SPAN&gt;
    custom_col &lt;SPAN class=""&gt;&amp;lt;-&lt;/SPAN&gt; colorRampPalette&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;c&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;"#8B0000"&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;"#FFD700"&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;"#006400"&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;200&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
    
    &lt;SPAN class=""&gt;# Set plot background color and text color&lt;/SPAN&gt;
    par&lt;SPAN class=""&gt;(&lt;/SPAN&gt;bg &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"#003165"&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; col.lab &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"white"&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; col.axis &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"white"&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; col.main &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"white"&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; col.sub &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"white"&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
    
    &lt;SPAN class=""&gt;# Plot the correlation matrix using corrplot with custom settings&lt;/SPAN&gt;
    corrplot&lt;SPAN class=""&gt;(&lt;/SPAN&gt;cor_matrix&lt;SPAN class=""&gt;,&lt;/SPAN&gt; method &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"color"&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; type &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"upper"&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; 
             tl.col &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"white"&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; tl.srt &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;45&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; 
             addCoef.col &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"white"&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; number.cex &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;0.7&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt;
             col &lt;SPAN class=""&gt;=&lt;/SPAN&gt; custom_col&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
&lt;SPAN class=""&gt;}&lt;/SPAN&gt; &lt;SPAN class=""&gt;else&lt;/SPAN&gt; &lt;SPAN class=""&gt;{&lt;/SPAN&gt;
    plot.new&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
    par&lt;SPAN class=""&gt;(&lt;/SPAN&gt;bg &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"#003165"&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
    text&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;0.5&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;0.5&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;"No data available"&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; cex &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;1.5&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; col &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"white"&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
&lt;SPAN class=""&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristianAU_2-1719220009308.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1121062i099F36D24D94E726/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristianAU_2-1719220009308.png" alt="ChristianAU_2-1719220009308.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 24 Jun 2024 09:10:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/R-correlation-plot-visual/m-p/4006585#M53676</guid>
      <dc:creator>ChristianAU</dc:creator>
      <dc:date>2024-06-24T09:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: R correlation plot visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/R-correlation-plot-visual/m-p/4008220#M53688</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/732475"&gt;@ChristianAU&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To change the color of the text within the red line to white in your R script visual, you need to adjust the text label color parameters in the corrplot function. Specifically, you need to make sure all text elements in the plot are set to white. Here’s the updated script:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Load necessary libraries
library(ggplot2)
library(reshape2)
library(corrplot)

# Ensure that the dataset is not empty
if(nrow(dataset) &amp;gt; 0) {
    # Compute the correlation matrix
    cor_matrix &amp;lt;- cor(dataset, use = "complete.obs")
    
    # Increase plot size and adjust margins for better readability
    par(mar = c(4, 4, 2, 2), oma = c(2, 2, 2, 2), mfrow = c(1, 1))
    options(repr.plot.width=10, repr.plot.height=8)
    
    # Define custom color palette
    custom_col &amp;lt;- colorRampPalette(c("#8B0000", "#FFD700", "#006400"))(200)
    
    # Set plot background color and text color
    par(bg = "#003165", col.lab = "white", col.axis = "white", col.main = "white", col.sub = "white")
    
    # Plot the correlation matrix using corrplot with custom settings
    corrplot(cor_matrix, method = "color", type = "upper", 
             tl.col = "white", tl.srt = 45, 
             addCoef.col = "white", number.cex = 0.7,
             col = custom_col,
             cl.cex = 1, cl.col = "white", cl.ratio = 0.2)
} else {
    plot.new()
    par(bg = "#003165")
    text(0.5, 0.5, "No data available", cex = 1.5, col = "white")
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hackcrr&lt;/P&gt;&lt;P&gt;If this post helps, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;kudos to this post&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 05:03:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/R-correlation-plot-visual/m-p/4008220#M53688</guid>
      <dc:creator>hackcrr</dc:creator>
      <dc:date>2024-06-25T05:03:00Z</dc:date>
    </item>
  </channel>
</rss>

