<?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: How to create HEATMAPS that show the correlation (with different colour) and stars for the pvalu in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-create-HEATMAPS-that-show-the-correlation-with-different/m-p/72454#M35616</link>
    <description>&lt;P&gt;Here is a script that should be a good start in creating what you want&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="matrix.PNG" style="width: 504px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12412i052CA6E1D86AE9CB/image-dimensions/504x537?v=v2" width="504" height="537" role="button" title="matrix.PNG" alt="matrix.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Open a sample data table
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

// Run the Correlation Platform to get the data
mult = dt &amp;lt;&amp;lt; Multivariate(
	invisible,
	Y( :NPN1, :PNP1, :PNP2, :NPN2, :PNP3, :IVP1 ),
	Estimation Method( "Row-wise" ),
	Matrix Format( "Square" ),
	Scatterplot Matrix( 0 ),
	Pairwise Correlations( 1 )
);

// Create data tables of the stats required
dtCorr = Report( mult )["Correlations"][Matrix Box( 1 )] &amp;lt;&amp;lt; make into data table(invisible);
dtSig = Report( mult )["Pairwise Correlations"][Table Box( 1 )] &amp;lt;&amp;lt; make into data table(invisible);

// Delete the Row Name column, not wanted in analysis
dtCorr &amp;lt;&amp;lt; delete columns( 1 );

// Set the 100 colors to be used to color the graph
colorMatrix = [-16558990, -16558990, -16557962, -16557962, -16557191, -16557191, -16556419, -16556419, -16555391,
-16555391, -16554619, -16554619, -16553848, -16553848, -16553076, -16553076, -16552048, -16552048, -16551277,
-16551277, -16550506, -16550506, -16549735, -16549735, -16548964, -16548964, -16547936, -16547936, -16481629,
-16481629, -16480858, -16480858, -16480087, -16480087, -16479316, -16479316, -16478288, -16478288, -16477517,
-16477517, -16476746, -16476746, -16410184, -16410184, -16343621, -16343621, -16277315, -16277315, -16210752,
-16210752, -16144190, -16144190, -16077628, -16077628, -16011321, -16011321, -15944759, -15944759, -15878196,
-15878196, -15811634, -15811634, -15745328, -15745328, -15678765, -15678765, -15612459, -15612459, -15415082,
-15415082, -15217705, -15217705, -15020328, -15020328, -14822951, -14822951, -14625829, -14625829, -14428452,
-14428452, -14231075, -14231075, -14099234, -14099234, -13901857, -13901857, -13704735, -13704735, -13507358,
-13507358, -13309981, -13309981, -13113116, -13113116, -12916508, -12916508, -12719643, -12719643, -12522778,
-12522778];

// Get the column names in the Corr data table
columnNamesList = dtCorr &amp;lt;&amp;lt; get column names( string );

// Create the output
nw = New Window( "Correlations",
	gb = Graph Box(
		Frame Size( 800, 800 ),
		X Scale( 0, N Col( dtCorr ) + 2 ),
		Y Scale( 0, N Rows( dtCorr ) + 2 ),
		// Loop across the the rows and columns to find the correlation values and plot the results
		For( x = 1, x &amp;lt;= N Cols( dtCorr ), x++,
			For( y = 1, y &amp;lt;= N Rows( dtCorr ), y++,
				// Find the color to use from the color matrix
				fc = Abs( Floor( (dtCorr[y, x] * 100) + .5 ) );
				If( fc &amp;lt; 1, fc = 1 );
				fcc = colorMatrix[fc];
				// Set the color
				Eval( Parse( "Fill Color(" || Char( fcc ) || ");" ) );
				Pen Color( "black" );
				
				// create the output square
				xlist1 = Matrix( x ) || Matrix( x ) || Matrix( x + 1 ) || Matrix( x + 1 );
				xlist2 = Matrix( N Cols( dtCorr ) + 1 - y ) || Matrix( N Cols( dtCorr ) + 1 - y + 1 ) ||
				Matrix( N Cols( dtCorr ) + 1 - y + 1 ) || Matrix( N Cols( dtCorr ) + 1 - y );
				Polygon( xlist1, xlist2 );
				// Draw a line around the square
				Line( xlist1, xlist2 );
			)
		);
		
		// Add the "*" for significant correlations, by going through the significant data table
		Text Color( "Black" );
		Text Size( 20 );
		
		For( i = 1, i &amp;lt;= N Rows( dtSig ), i++,
			If( dtSig:Signif Prob[i] &amp;lt;= .05,
				textList = {};
				Insert Into( textList, Loc( columnNamesList, dtSig:Variable[i] )[1] + .5 );
				Insert Into( textList, N Cols( dtCorr ) + 1 - Loc( columnNamesList, dtSig:by Variable[i] )[1] + .5 );
				
				Text( Center Justified, textList, "*" );
				textList = {};
				Insert Into( textList, Loc( columnNamesList, dtSig:by Variable[i] )[1] + .5 );
				Insert Into( textList, N Cols( dtCorr ) + 1 - Loc( columnNamesList, dtSig:Variable[i] )[1] + .5 );
				
				// Write the symbol in the middle of the square
				Text( Center Justified, textList, "*" );
			)
		);
	)
	
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Sep 2018 21:21:21 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2018-09-12T21:21:21Z</dc:date>
    <item>
      <title>How to create HEATMAPS that show the correlation (with different colour) and stars for the pvalue?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-HEATMAPS-that-show-the-correlation-with-different/m-p/72364#M35604</link>
      <description />
      <pubDate>Wed, 12 Sep 2018 16:55:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-HEATMAPS-that-show-the-correlation-with-different/m-p/72364#M35604</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-09-12T16:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to create HEATMAPS that show the correlation (with different colour) and stars for the pvalu</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-HEATMAPS-that-show-the-correlation-with-different/m-p/72385#M35605</link>
      <description>&lt;P&gt;From the Analyze pulldown menu:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; Analyze==&amp;gt;Multivariate Methods==&amp;gt;Multivariate&lt;/P&gt;
&lt;P&gt;In the report output's red triangle, select Color Maps&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="colormap.PNG" style="width: 271px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12398i3FEB8371860F9021/image-size/large?v=v2&amp;amp;px=999" role="button" title="colormap.PNG" alt="colormap.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 17:25:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-HEATMAPS-that-show-the-correlation-with-different/m-p/72385#M35605</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-09-12T17:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to create HEATMAPS that show the correlation (with different colour) and stars for the pvalu</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-HEATMAPS-that-show-the-correlation-with-different/m-p/72403#M35607</link>
      <description>&lt;P&gt;yes, but what if you would also like to put stars on each correlation (denoting p values &amp;lt;0.05)? As eg in the photo attached?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 17:43:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-HEATMAPS-that-show-the-correlation-with-different/m-p/72403#M35607</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-09-12T17:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to create HEATMAPS that show the correlation (with different colour) and stars for the pvalu</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-HEATMAPS-that-show-the-correlation-with-different/m-p/72417#M35608</link>
      <description>&lt;P&gt;There isn't a builtin option to complete the full list of your requirements.&amp;nbsp; However, a not very difficult script could generate the chart.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:22:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-HEATMAPS-that-show-the-correlation-with-different/m-p/72417#M35608</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-09-12T18:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to create HEATMAPS that show the correlation (with different colour) and stars for the pvalu</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-HEATMAPS-that-show-the-correlation-with-different/m-p/72421#M35609</link>
      <description>&lt;P&gt;Could you give some more info for ''script dummies'' as me?&lt;/P&gt;&lt;P&gt;I recently (today) did my 1st heatmap on JMP following the instructions given in this very useful video:&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=uaBFoI3l-8U" target="_blank"&gt;https://www.youtube.com/watch?v=uaBFoI3l-8U&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If somebody could create a similar video but also including the script for how&amp;nbsp;to add the stars (eg *p&amp;lt;0.05, **p&amp;lt;0.01, **** p&amp;lt;0.001), i think the whole JMP community would be really happy about it :)&lt;/img&gt;&lt;/P&gt;&lt;P&gt;Alternatively if someone had some time to explain step by step what script would be needed and how it could be incorporated in a JMP dataset it would still be very useful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the understanding!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:50:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-HEATMAPS-that-show-the-correlation-with-different/m-p/72421#M35609</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-09-12T18:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create HEATMAPS that show the correlation (with different colour) and stars for the pvalu</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-HEATMAPS-that-show-the-correlation-with-different/m-p/72454#M35616</link>
      <description>&lt;P&gt;Here is a script that should be a good start in creating what you want&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="matrix.PNG" style="width: 504px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12412i052CA6E1D86AE9CB/image-dimensions/504x537?v=v2" width="504" height="537" role="button" title="matrix.PNG" alt="matrix.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Open a sample data table
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

// Run the Correlation Platform to get the data
mult = dt &amp;lt;&amp;lt; Multivariate(
	invisible,
	Y( :NPN1, :PNP1, :PNP2, :NPN2, :PNP3, :IVP1 ),
	Estimation Method( "Row-wise" ),
	Matrix Format( "Square" ),
	Scatterplot Matrix( 0 ),
	Pairwise Correlations( 1 )
);

// Create data tables of the stats required
dtCorr = Report( mult )["Correlations"][Matrix Box( 1 )] &amp;lt;&amp;lt; make into data table(invisible);
dtSig = Report( mult )["Pairwise Correlations"][Table Box( 1 )] &amp;lt;&amp;lt; make into data table(invisible);

// Delete the Row Name column, not wanted in analysis
dtCorr &amp;lt;&amp;lt; delete columns( 1 );

// Set the 100 colors to be used to color the graph
colorMatrix = [-16558990, -16558990, -16557962, -16557962, -16557191, -16557191, -16556419, -16556419, -16555391,
-16555391, -16554619, -16554619, -16553848, -16553848, -16553076, -16553076, -16552048, -16552048, -16551277,
-16551277, -16550506, -16550506, -16549735, -16549735, -16548964, -16548964, -16547936, -16547936, -16481629,
-16481629, -16480858, -16480858, -16480087, -16480087, -16479316, -16479316, -16478288, -16478288, -16477517,
-16477517, -16476746, -16476746, -16410184, -16410184, -16343621, -16343621, -16277315, -16277315, -16210752,
-16210752, -16144190, -16144190, -16077628, -16077628, -16011321, -16011321, -15944759, -15944759, -15878196,
-15878196, -15811634, -15811634, -15745328, -15745328, -15678765, -15678765, -15612459, -15612459, -15415082,
-15415082, -15217705, -15217705, -15020328, -15020328, -14822951, -14822951, -14625829, -14625829, -14428452,
-14428452, -14231075, -14231075, -14099234, -14099234, -13901857, -13901857, -13704735, -13704735, -13507358,
-13507358, -13309981, -13309981, -13113116, -13113116, -12916508, -12916508, -12719643, -12719643, -12522778,
-12522778];

// Get the column names in the Corr data table
columnNamesList = dtCorr &amp;lt;&amp;lt; get column names( string );

// Create the output
nw = New Window( "Correlations",
	gb = Graph Box(
		Frame Size( 800, 800 ),
		X Scale( 0, N Col( dtCorr ) + 2 ),
		Y Scale( 0, N Rows( dtCorr ) + 2 ),
		// Loop across the the rows and columns to find the correlation values and plot the results
		For( x = 1, x &amp;lt;= N Cols( dtCorr ), x++,
			For( y = 1, y &amp;lt;= N Rows( dtCorr ), y++,
				// Find the color to use from the color matrix
				fc = Abs( Floor( (dtCorr[y, x] * 100) + .5 ) );
				If( fc &amp;lt; 1, fc = 1 );
				fcc = colorMatrix[fc];
				// Set the color
				Eval( Parse( "Fill Color(" || Char( fcc ) || ");" ) );
				Pen Color( "black" );
				
				// create the output square
				xlist1 = Matrix( x ) || Matrix( x ) || Matrix( x + 1 ) || Matrix( x + 1 );
				xlist2 = Matrix( N Cols( dtCorr ) + 1 - y ) || Matrix( N Cols( dtCorr ) + 1 - y + 1 ) ||
				Matrix( N Cols( dtCorr ) + 1 - y + 1 ) || Matrix( N Cols( dtCorr ) + 1 - y );
				Polygon( xlist1, xlist2 );
				// Draw a line around the square
				Line( xlist1, xlist2 );
			)
		);
		
		// Add the "*" for significant correlations, by going through the significant data table
		Text Color( "Black" );
		Text Size( 20 );
		
		For( i = 1, i &amp;lt;= N Rows( dtSig ), i++,
			If( dtSig:Signif Prob[i] &amp;lt;= .05,
				textList = {};
				Insert Into( textList, Loc( columnNamesList, dtSig:Variable[i] )[1] + .5 );
				Insert Into( textList, N Cols( dtCorr ) + 1 - Loc( columnNamesList, dtSig:by Variable[i] )[1] + .5 );
				
				Text( Center Justified, textList, "*" );
				textList = {};
				Insert Into( textList, Loc( columnNamesList, dtSig:by Variable[i] )[1] + .5 );
				Insert Into( textList, N Cols( dtCorr ) + 1 - Loc( columnNamesList, dtSig:Variable[i] )[1] + .5 );
				
				// Write the symbol in the middle of the square
				Text( Center Justified, textList, "*" );
			)
		);
	)
	
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Sep 2018 21:21:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-HEATMAPS-that-show-the-correlation-with-different/m-p/72454#M35616</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-09-12T21:21:21Z</dc:date>
    </item>
  </channel>
</rss>

