<?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: Confusion matrix colour and count based on different variables in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Confusion-matrix-colour-and-count-based-on-different-variables/m-p/547354#M76481</link>
    <description>&lt;P&gt;Sorry about that, I missed saving that step.&amp;nbsp; Again here I&amp;nbsp;&lt;SPAN&gt;summarized the table first and then drew the graph using row labels instead of the counts, but this time I actually defined row labels:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ih_0-1663773802794.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/45662i7DBA459285B0EC49/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ih_0-1663773802794.png" alt="ih_0-1663773802794.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = Open( "$Sample_data/big class.jmp" );

random reset(2);
dt &amp;lt;&amp;lt; New Column("Age 2", Numeric, "Ordinal", Format("Fixed Dec", 5, 0), Formula(:age[Col Shuffle()]));
dt &amp;lt;&amp;lt; Run Formulas;
dt:age &amp;lt;&amp;lt; Set Name("Age 1");
dtSum = (sum = dt &amp;lt;&amp;lt; Tabulate(
	Add Table(
		Column Table( Statistics( N ) ),
		Row Table( Grouping Columns( :"Age 2"n, :"Age 1"n ) )
	)
)) &amp;lt;&amp;lt; Make Into Data Table;

dtSum &amp;lt;&amp;lt; New Column("Is Diagonal", Numeric, "Nominal", Format("Best", 12), Formula(:Age 1 == :Age 2));

dtSum:N &amp;lt;&amp;lt; Label( 1 );

gb = dtSum &amp;lt;&amp;lt; Graph Builder(
	Size( 525, 450 ),
	Show Control Panel( 0 ),
	Variables( X( :Age 1 ), Y( :Age 2 ), Color( :Is Diagonal ) ),
	Elements( Heatmap( X, Y, Legend( 5 ), Label( "Label by Row" ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				5,
				Properties( 0, {Fill Color( -15790017 )}, Item ID( "0", 1 ) ),
				Properties( 1, {Fill Color( 5 )}, Item ID( "1", 1 ) )
			)}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Sep 2022 15:24:47 GMT</pubDate>
    <dc:creator>ih</dc:creator>
    <dc:date>2022-09-21T15:24:47Z</dc:date>
    <item>
      <title>Confusion matrix colour and count based on different variables</title>
      <link>https://community.jmp.com/t5/Discussions/Confusion-matrix-colour-and-count-based-on-different-variables/m-p/547169#M76466</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working on a confusion matrix using the graph builder. I have 2 columns one is Known class (y-axis) an the other Predicted class (x-axis). I want the numbers inside the boxes to show the number of samples in each box. As shown in picture below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Agustin_1-1663762133816.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/45653i1C7EFD83AA7C3064/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Agustin_1-1663762133816.png" alt="Agustin_1-1663762133816.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, instead of the colour gradient map, I would like to have the main diagonal (True Positives) be one colour and the rest of the boxes a different colour. I have a column that is either 1 or 0 depending on whether the sample is a True Positive or not, however when I add this column to the colour option in Graph Builder this happens:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Agustin_2-1663762335690.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/45654i968ABC6997A05959/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Agustin_2-1663762335690.png" alt="Agustin_2-1663762335690.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is there a way I can have the colours as in the second picture, but the labels of the first picture?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:27:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Confusion-matrix-colour-and-count-based-on-different-variables/m-p/547169#M76466</guid>
      <dc:creator>Agustin</dc:creator>
      <dc:date>2023-06-11T11:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Confusion matrix colour and count based on different variables</title>
      <link>https://community.jmp.com/t5/Discussions/Confusion-matrix-colour-and-count-based-on-different-variables/m-p/547327#M76476</link>
      <description>&lt;P&gt;You could summarize the table first and then draw your graph using row labels instead of the counts:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ih_1-1663772650455.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/45656iE0989C30760AE939/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ih_1-1663772650455.png" alt="ih_1-1663772650455.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = Open( "$Sample_data/big class.jmp" );
&lt;BR /&gt;random reset(2);
dt &amp;lt;&amp;lt; New Column("Age 2", Numeric, "Ordinal", Format("Fixed Dec", 5, 0), Formula(:age[Col Shuffle()]));
dt:age &amp;lt;&amp;lt; Set Name("Age 1");
dtSum = (dt &amp;lt;&amp;lt; Tabulate(
	Add Table(
		Column Table( Statistics( N ) ),
		Row Table( Grouping Columns( :"Age 2"n, :"Age 1"n ) )
	)
)) &amp;lt;&amp;lt; Make Into Data Table;

dtSum &amp;lt;&amp;lt; New Column("Is Diagonal", Numeric, "Nominal", Format("Best", 12), Formula(:Age 1 == :Age 2));

dtSum &amp;lt;&amp;lt; Graph Builder(
	Size( 525, 450 ),
	Show Control Panel( 0 ),
	Variables( X( :Age 1 ), Y( :Age 2 ), Color( :Is Diagonal ) ),
	Elements( Heatmap( X, Y, Legend( 5 ), Label( "Label by Row" ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				5,
				Properties( 0, {Fill Color( -15790017 )}, Item ID( "0", 1 ) ),
				Properties( 1, {Fill Color( 5 )}, Item ID( "1", 1 ) )
			)}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 15:04:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Confusion-matrix-colour-and-count-based-on-different-variables/m-p/547327#M76476</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2022-09-21T15:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Confusion matrix colour and count based on different variables</title>
      <link>https://community.jmp.com/t5/Discussions/Confusion-matrix-colour-and-count-based-on-different-variables/m-p/547346#M76479</link>
      <description>&lt;P&gt;Thank you for your answer but I don't think this gives the right solution, see below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Agustin_0-1663773226396.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/45661i7D5CB9E55ECAA04E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Agustin_0-1663773226396.png" alt="Agustin_0-1663773226396.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Left shows the actual values that should be displayed, right is what the script provided results in.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 15:14:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Confusion-matrix-colour-and-count-based-on-different-variables/m-p/547346#M76479</guid>
      <dc:creator>Agustin</dc:creator>
      <dc:date>2022-09-21T15:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Confusion matrix colour and count based on different variables</title>
      <link>https://community.jmp.com/t5/Discussions/Confusion-matrix-colour-and-count-based-on-different-variables/m-p/547354#M76481</link>
      <description>&lt;P&gt;Sorry about that, I missed saving that step.&amp;nbsp; Again here I&amp;nbsp;&lt;SPAN&gt;summarized the table first and then drew the graph using row labels instead of the counts, but this time I actually defined row labels:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ih_0-1663773802794.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/45662i7DBA459285B0EC49/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ih_0-1663773802794.png" alt="ih_0-1663773802794.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = Open( "$Sample_data/big class.jmp" );

random reset(2);
dt &amp;lt;&amp;lt; New Column("Age 2", Numeric, "Ordinal", Format("Fixed Dec", 5, 0), Formula(:age[Col Shuffle()]));
dt &amp;lt;&amp;lt; Run Formulas;
dt:age &amp;lt;&amp;lt; Set Name("Age 1");
dtSum = (sum = dt &amp;lt;&amp;lt; Tabulate(
	Add Table(
		Column Table( Statistics( N ) ),
		Row Table( Grouping Columns( :"Age 2"n, :"Age 1"n ) )
	)
)) &amp;lt;&amp;lt; Make Into Data Table;

dtSum &amp;lt;&amp;lt; New Column("Is Diagonal", Numeric, "Nominal", Format("Best", 12), Formula(:Age 1 == :Age 2));

dtSum:N &amp;lt;&amp;lt; Label( 1 );

gb = dtSum &amp;lt;&amp;lt; Graph Builder(
	Size( 525, 450 ),
	Show Control Panel( 0 ),
	Variables( X( :Age 1 ), Y( :Age 2 ), Color( :Is Diagonal ) ),
	Elements( Heatmap( X, Y, Legend( 5 ), Label( "Label by Row" ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				5,
				Properties( 0, {Fill Color( -15790017 )}, Item ID( "0", 1 ) ),
				Properties( 1, {Fill Color( 5 )}, Item ID( "1", 1 ) )
			)}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 15:24:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Confusion-matrix-colour-and-count-based-on-different-variables/m-p/547354#M76481</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2022-09-21T15:24:47Z</dc:date>
    </item>
  </channel>
</rss>

