cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-547169%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9F%BA%E4%BA%8E%E4%B8%8D%E5%90%8C%E5%8F%98%E9%87%8F%E7%9A%84%E6%B7%B7%E6%B7%86%E7%9F%A9%E9%98%B5%E9%A2%9C%E8%89%B2%E5%92%8C%E8%AE%A1%E6%95%B0%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-547169%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E4%BD%A0%E5%A5%BD%EF%BC%8C%3C%2FP%3E%3CP%3E%E6%88%91%E6%AD%A3%E5%9C%A8%E4%BD%BF%E7%94%A8%E5%9B%BE%E5%BD%A2%E7%94%9F%E6%88%90%E5%99%A8%E5%88%B6%E4%BD%9C%E6%B7%B7%E6%B7%86%E7%9F%A9%E9%98%B5%E3%80%82%20%E6%88%91%E6%9C%89%E4%B8%A4%E5%88%97%EF%BC%8C%E4%B8%80%E5%88%97%E6%98%AF%E5%B7%B2%E7%9F%A5%E7%B1%BB%E5%88%AB%EF%BC%88y%20%E8%BD%B4%EF%BC%89%EF%BC%8C%E5%8F%A6%E4%B8%80%E5%88%97%E6%98%AF%E9%A2%84%E6%B5%8B%E7%B1%BB%E5%88%AB%EF%BC%88x%20%E8%BD%B4%EF%BC%89%E3%80%82%20%E6%88%91%E5%B8%8C%E6%9C%9B%E6%96%B9%E6%A1%86%E5%86%85%E7%9A%84%E6%95%B0%E5%AD%97%E6%98%BE%E7%A4%BA%E6%AF%8F%E4%B8%AA%E6%96%B9%E6%A1%86%E4%B8%AD%E7%9A%84%E6%A0%B7%E6%9C%AC%E6%95%B0%E9%87%8F%E3%80%82%20%E5%A6%82%E4%B8%8B%E5%9B%BE%E6%89%80%E7%A4%BA%E3%80%82%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Agustin_1-1663762133816.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Agustin_1-1663762133816.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Agustin_1-1663762133816.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F45653i1C7EFD83AA7C3064%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Agustin_1-1663762133816.png%22%20alt%3D%22Agustin_1-1663762133816.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%E4%BD%86%E6%98%AF%EF%BC%8C%E6%88%91%E5%B8%8C%E6%9C%9B%E4%B8%BB%E5%AF%B9%E8%A7%92%E7%BA%BF%EF%BC%88%E7%9C%9F%E9%98%B3%E6%80%A7%EF%BC%89%E4%B8%BA%E4%B8%80%E7%A7%8D%E9%A2%9C%E8%89%B2%EF%BC%8C%E8%80%8C%E5%85%B6%E4%BD%99%E6%A1%86%E4%B8%BA%E4%B8%8D%E5%90%8C%E9%A2%9C%E8%89%B2%EF%BC%8C%E8%80%8C%E4%B8%8D%E6%98%AF%E9%A2%9C%E8%89%B2%E6%B8%90%E5%8F%98%E5%9B%BE%E3%80%82%20%E6%88%91%E6%9C%89%E4%B8%80%E5%88%97%E4%B8%BA%201%20%E6%88%96%200%EF%BC%8C%E5%85%B7%E4%BD%93%E5%8F%96%E5%86%B3%E4%BA%8E%E6%A0%B7%E6%9C%AC%E6%98%AF%E5%90%A6%E4%B8%BA%E7%9C%9F%E9%98%B3%E6%80%A7%EF%BC%8C%E4%BD%86%E6%98%AF%E5%BD%93%E6%88%91%E5%B0%86%E6%AD%A4%E5%88%97%E6%B7%BB%E5%8A%A0%E5%88%B0%E5%9B%BE%E5%BD%A2%E7%94%9F%E6%88%90%E5%99%A8%E4%B8%AD%E7%9A%84%E9%A2%9C%E8%89%B2%E9%80%89%E9%A1%B9%E6%97%B6%EF%BC%8C%E4%BC%9A%E5%8F%91%E7%94%9F%E8%BF%99%E7%A7%8D%E6%83%85%E5%86%B5%EF%BC%9A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Agustin_2-1663762335690.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Agustin_2-1663762335690.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Agustin_2-1663762335690.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F45654i968ABC6997A05959%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Agustin_2-1663762335690.png%22%20alt%3D%22Agustin_2-1663762335690.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E6%9C%89%E6%B2%A1%E6%9C%89%E5%8A%9E%E6%B3%95%E8%AE%A9%E6%88%91%E6%8B%A5%E6%9C%89%E7%AC%AC%E4%BA%8C%E5%BC%A0%E5%9B%BE%E7%89%87%E4%B8%AD%E7%9A%84%E9%A2%9C%E8%89%B2%EF%BC%8C%E4%BD%86%E6%8B%A5%E6%9C%89%E7%AC%AC%E4%B8%80%E5%BC%A0%E5%9B%BE%E7%89%87%E7%9A%84%E6%A0%87%E7%AD%BE%EF%BC%9F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%E8%B0%A2%E8%B0%A2%E4%BD%A0%EF%BC%81%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-547169%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3E%E5%A4%A7%E8%A7%84%E6%A8%A1%E5%AE%9A%E5%88%B6%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-547354%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E5%9F%BA%E4%BA%8E%E4%B8%8D%E5%90%8C%E5%8F%98%E9%87%8F%E7%9A%84%E6%B7%B7%E6%B7%86%E7%9F%A9%E9%98%B5%E9%A2%9C%E8%89%B2%E5%92%8C%E8%AE%A1%E6%95%B0%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-547354%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E6%8A%B1%E6%AD%89%EF%BC%8C%E6%88%91%E9%94%99%E8%BF%87%E4%BA%86%E4%BF%9D%E5%AD%98%E8%AF%A5%E6%AD%A5%E9%AA%A4%E3%80%82%E6%88%91%E5%8F%88%E5%9C%A8%E8%BF%99%E9%87%8C%3CSPAN%3E%E5%85%88%E6%80%BB%E7%BB%93%E8%A1%A8%E6%A0%BC%EF%BC%8C%E7%84%B6%E5%90%8E%E4%BD%BF%E7%94%A8%E8%A1%8C%E6%A0%87%E7%AD%BE%E8%80%8C%E4%B8%8D%E6%98%AF%E8%AE%A1%E6%95%B0%E6%9D%A5%E7%BB%98%E5%88%B6%E5%9B%BE%E8%A1%A8%EF%BC%8C%E4%BD%86%E8%BF%99%E6%AC%A1%E6%88%91%E5%AE%9E%E9%99%85%E4%B8%8A%E5%AE%9A%E4%B9%89%E4%BA%86%E8%A1%8C%E6%A0%87%E7%AD%BE%EF%BC%9A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ih_0-1663773802794.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22ih_0-1663773802794.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22ih_0-1663773802794.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F45662i7DBA459285B0EC49%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22ih_0-1663773802794.png%22%20alt%3D%22ih_0-1663773802794.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0A%0Adt%20%3D%20Open(%20%22%24Sample_data%2Fbig%20class.jmp%22%20)%3B%0A%0Arandom%20reset(2)%3B%0Adt%20%26lt%3B%26lt%3B%20New%20Column(%22Age%202%22%2C%20Numeric%2C%20%22Ordinal%22%2C%20Format(%22Fixed%20Dec%22%2C%205%2C%200)%2C%20Formula(%3Aage%5BCol%20Shuffle()%5D))%3B%0Adt%20%26lt%3B%26lt%3B%20Run%20Formulas%3B%0Adt%3Aage%20%26lt%3B%26lt%3B%20Set%20Name(%22Age%201%22)%3B%0AdtSum%20%3D%20(sum%20%3D%20dt%20%26lt%3B%26lt%3B%20Tabulate(%0A%20Add%20Table(%0A%20%20Column%20Table(%20Statistics(%20N%20)%20)%2C%0A%20%20Row%20Table(%20Grouping%20Columns(%20%3A%22Age%202%22n%2C%20%3A%22Age%201%22n%20)%20)%0A%20)%0A))%20%26lt%3B%26lt%3B%20Make%20Into%20Data%20Table%3B%0A%0AdtSum%20%26lt%3B%26lt%3B%20New%20Column(%22Is%20Diagonal%22%2C%20Numeric%2C%20%22Nominal%22%2C%20Format(%22Best%22%2C%2012)%2C%20Formula(%3AAge%201%20%3D%3D%20%3AAge%202))%3B%0A%0AdtSum%3AN%20%26lt%3B%26lt%3B%20Label(%201%20)%3B%0A%0Agb%20%3D%20dtSum%20%26lt%3B%26lt%3B%20Graph%20Builder(%0A%20Size(%20525%2C%20450%20)%2C%0A%20Show%20Control%20Panel(%200%20)%2C%0A%20Variables(%20X(%20%3AAge%201%20)%2C%20Y(%20%3AAge%202%20)%2C%20Color(%20%3AIs%20Diagonal%20)%20)%2C%0A%20Elements(%20Heatmap(%20X%2C%20Y%2C%20Legend(%205%20)%2C%20Label(%20%22Label%20by%20Row%22%20)%20)%20)%2C%0A%20SendToReport(%0A%20%20Dispatch(%0A%20%20%20%7B%7D%2C%0A%20%20%20%22400%22%2C%0A%20%20%20ScaleBox%2C%0A%20%20%20%7BLegend%20Model(%0A%20%20%20%205%2C%0A%20%20%20%20Properties(%200%2C%20%7BFill%20Color(%20-15790017%20)%7D%2C%20Item%20ID(%20%220%22%2C%201%20)%20)%2C%0A%20%20%20%20Properties(%201%2C%20%7BFill%20Color(%205%20)%7D%2C%20Item%20ID(%20%221%22%2C%201%20)%20)%0A%20%20%20)%7D%0A%20%20)%0A%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-547346%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E5%9F%BA%E4%BA%8E%E4%B8%8D%E5%90%8C%E5%8F%98%E9%87%8F%E7%9A%84%E6%B7%B7%E6%B7%86%E7%9F%A9%E9%98%B5%E9%A2%9C%E8%89%B2%E5%92%8C%E8%AE%A1%E6%95%B0%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-547346%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E6%84%9F%E8%B0%A2%E6%82%A8%E7%9A%84%E5%9B%9E%E7%AD%94%EF%BC%8C%E4%BD%86%E6%88%91%E8%AE%A4%E4%B8%BA%E8%BF%99%E6%B2%A1%E6%9C%89%E7%BB%99%E5%87%BA%E6%AD%A3%E7%A1%AE%E7%9A%84%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%EF%BC%8C%E8%AF%B7%E5%8F%82%E8%A7%81%E4%B8%8B%E6%96%87%EF%BC%9A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Agustin_0-1663773226396.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Agustin_0-1663773226396.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Agustin_0-1663773226396.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F45661i7D5CB9E55ECAA04E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Agustin_0-1663773226396.png%22%20alt%3D%22Agustin_0-1663773226396.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%E5%B7%A6%E8%BE%B9%E6%98%BE%E7%A4%BA%E5%BA%94%E8%AF%A5%E6%98%BE%E7%A4%BA%E7%9A%84%E5%AE%9E%E9%99%85%E5%80%BC%EF%BC%8C%E5%8F%B3%E8%BE%B9%E6%98%AF%E8%84%9A%E6%9C%AC%E6%8F%90%E4%BE%9B%E7%9A%84%E7%BB%93%E6%9E%9C%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-547327%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E5%9F%BA%E4%BA%8E%E4%B8%8D%E5%90%8C%E5%8F%98%E9%87%8F%E7%9A%84%E6%B7%B7%E6%B7%86%E7%9F%A9%E9%98%B5%E9%A2%9C%E8%89%B2%E5%92%8C%E8%AE%A1%E6%95%B0%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-547327%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E6%82%A8%E5%8F%AF%E4%BB%A5%E5%85%88%E6%80%BB%E7%BB%93%E8%A1%A8%E6%A0%BC%EF%BC%8C%E7%84%B6%E5%90%8E%E4%BD%BF%E7%94%A8%E8%A1%8C%E6%A0%87%E7%AD%BE%E8%80%8C%E4%B8%8D%E6%98%AF%E8%AE%A1%E6%95%B0%E6%9D%A5%E7%BB%98%E5%88%B6%E5%9B%BE%E8%A1%A8%EF%BC%9A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ih_1-1663772650455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22ih_1-1663772650455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22ih_1-1663772650455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F45656iE0989C30760AE939%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22ih_1-1663772650455.png%22%20alt%3D%22ih_1-1663772650455.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0A%0Adt%20%3D%20Open(%20%22%24Sample_data%2Fbig%20class.jmp%22%20)%3B%0A%3CBR%20%2F%3Erandom%20reset(2)%3B%0Adt%20%26lt%3B%26lt%3B%20New%20Column(%22Age%202%22%2C%20Numeric%2C%20%22Ordinal%22%2C%20Format(%22Fixed%20Dec%22%2C%205%2C%200)%2C%20Formula(%3Aage%5BCol%20Shuffle()%5D))%3B%0Adt%3Aage%20%26lt%3B%26lt%3B%20Set%20Name(%22Age%201%22)%3B%0AdtSum%20%3D%20(dt%20%26lt%3B%26lt%3B%20Tabulate(%0A%20Add%20Table(%0A%20%20Column%20Table(%20Statistics(%20N%20)%20)%2C%0A%20%20Row%20Table(%20Grouping%20Columns(%20%3A%22Age%202%22n%2C%20%3A%22Age%201%22n%20)%20)%0A%20)%0A))%20%26lt%3B%26lt%3B%20Make%20Into%20Data%20Table%3B%0A%0AdtSum%20%26lt%3B%26lt%3B%20New%20Column(%22Is%20Diagonal%22%2C%20Numeric%2C%20%22Nominal%22%2C%20Format(%22Best%22%2C%2012)%2C%20Formula(%3AAge%201%20%3D%3D%20%3AAge%202))%3B%0A%0AdtSum%20%26lt%3B%26lt%3B%20Graph%20Builder(%0A%20Size(%20525%2C%20450%20)%2C%0A%20Show%20Control%20Panel(%200%20)%2C%0A%20Variables(%20X(%20%3AAge%201%20)%2C%20Y(%20%3AAge%202%20)%2C%20Color(%20%3AIs%20Diagonal%20)%20)%2C%0A%20Elements(%20Heatmap(%20X%2C%20Y%2C%20Legend(%205%20)%2C%20Label(%20%22Label%20by%20Row%22%20)%20)%20)%2C%0A%20SendToReport(%0A%20%20Dispatch(%0A%20%20%20%7B%7D%2C%0A%20%20%20%22400%22%2C%0A%20%20%20ScaleBox%2C%0A%20%20%20%7BLegend%20Model(%0A%20%20%20%205%2C%0A%20%20%20%20Properties(%200%2C%20%7BFill%20Color(%20-15790017%20)%7D%2C%20Item%20ID(%20%220%22%2C%201%20)%20)%2C%0A%20%20%20%20Properties(%201%2C%20%7BFill%20Color(%205%20)%7D%2C%20Item%20ID(%20%221%22%2C%201%20)%20)%0A%20%20%20)%7D%0A%20%20)%0A%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
Agustin
Level IV

Confusion matrix colour and count based on different variables

Hi, 

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.

 

Agustin_1-1663762133816.png

 

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:

Agustin_2-1663762335690.png

Is there a way I can have the colours as in the second picture, but the labels of the first picture?

 

Thank you! 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Confusion matrix colour and count based on different variables

Sorry about that, I missed saving that step.  Again here I summarized the table first and then drew the graph using row labels instead of the counts, but this time I actually defined row labels:

 

ih_0-1663773802794.png

 

Names Default To Here( 1 );

dt = Open( "$Sample_data/big class.jmp" );

random reset(2);
dt << New Column("Age 2", Numeric, "Ordinal", Format("Fixed Dec", 5, 0), Formula(:age[Col Shuffle()]));
dt << Run Formulas;
dt:age << Set Name("Age 1");
dtSum = (sum = dt << Tabulate(
	Add Table(
		Column Table( Statistics( N ) ),
		Row Table( Grouping Columns( :"Age 2"n, :"Age 1"n ) )
	)
)) << Make Into Data Table;

dtSum << New Column("Is Diagonal", Numeric, "Nominal", Format("Best", 12), Formula(:Age 1 == :Age 2));

dtSum:N << Label( 1 );

gb = dtSum << 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 ) )
			)}
		)
	)
);

 

View solution in original post

3 REPLIES 3
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Confusion matrix colour and count based on different variables

You could summarize the table first and then draw your graph using row labels instead of the counts:

 

ih_1-1663772650455.png

 

 

Names Default To Here( 1 );

dt = Open( "$Sample_data/big class.jmp" );

random reset(2); dt << New Column("Age 2", Numeric, "Ordinal", Format("Fixed Dec", 5, 0), Formula(:age[Col Shuffle()])); dt:age << Set Name("Age 1"); dtSum = (dt << Tabulate( Add Table( Column Table( Statistics( N ) ), Row Table( Grouping Columns( :"Age 2"n, :"Age 1"n ) ) ) )) << Make Into Data Table; dtSum << New Column("Is Diagonal", Numeric, "Nominal", Format("Best", 12), Formula(:Age 1 == :Age 2)); dtSum << 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 ) ) )} ) ) );

 

Agustin
Level IV

Re: Confusion matrix colour and count based on different variables

Thank you for your answer but I don't think this gives the right solution, see below:

Agustin_0-1663773226396.png

 

Left shows the actual values that should be displayed, right is what the script provided results in.

ih
Super User (Alumni) ih
Super User (Alumni)

Re: Confusion matrix colour and count based on different variables

Sorry about that, I missed saving that step.  Again here I summarized the table first and then drew the graph using row labels instead of the counts, but this time I actually defined row labels:

 

ih_0-1663773802794.png

 

Names Default To Here( 1 );

dt = Open( "$Sample_data/big class.jmp" );

random reset(2);
dt << New Column("Age 2", Numeric, "Ordinal", Format("Fixed Dec", 5, 0), Formula(:age[Col Shuffle()]));
dt << Run Formulas;
dt:age << Set Name("Age 1");
dtSum = (sum = dt << Tabulate(
	Add Table(
		Column Table( Statistics( N ) ),
		Row Table( Grouping Columns( :"Age 2"n, :"Age 1"n ) )
	)
)) << Make Into Data Table;

dtSum << New Column("Is Diagonal", Numeric, "Nominal", Format("Best", 12), Formula(:Age 1 == :Age 2));

dtSum:N << Label( 1 );

gb = dtSum << 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 ) )
			)}
		)
	)
);

 

Recommended Articles