<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Plotting an Array</title>
    <link>http://www.mapleprimes.com/questions/144012-Plotting-An-Array</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Sat, 13 Jun 2026 18:11:38 GMT</lastBuildDate>
    <pubDate>Sat, 13 Jun 2026 18:11:38 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Plotting an Array</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Plotting an Array</title>
      <link>http://www.mapleprimes.com/questions/144012-Plotting-An-Array</link>
    </image>
    <item>
      <title>something</title>
      <link>http://www.mapleprimes.com/questions/144012-Plotting-An-Array?ref=Feed:MaplePrimes:Plotting an Array:Comments#answer144020</link>
      <itunes:summary>&lt;p&gt;It's not clear what you want, exactly. But you may be able to adjust this to suit.&lt;/p&gt;
&lt;pre&gt;restart:

M:=Matrix(10, 10,
 {(1, 1) = 1, (1, 2) = 1, (1, 3) = 1, (1, 4) = 1, (1, 5) = 1, (1, 6) = 1,
 (1, 7) = 1, (1, 8) = 1, (1, 9) = 1, (1, 10) = 1, (2, 1) = 1, (2, 2) = 1,
 (2, 3) = 2, (2, 4) = 2, (2, 5) = 2, (2, 6) = 2, (2, 7) = 1, (2, 8) = 1,
 (2, 9) = 1, (2, 10) = 1, (3, 1) = 1, (3, 2) = 2, (3, 3) = 2, (3, 4) = 2,
 (3, 5) = 2, (3, 6) = 2, (3, 7) = 2, (3, 8) = 2, (3, 9) = 1, (3, 10) = 1,
 (4, 1) = 1, (4, 2) = 2, (4, 3) = 2, (4, 4) = 2, (4, 5) = 2, (4, 6) = 2,
 (4, 7) = 2, (4, 8) = 2, (4, 9) = 1, (4, 10) = 1, (5, 1) = 2, (5, 2) = 2,
 (5, 3) = 2, (5, 4) = 2, (5, 5) = 2, (5, 6) = 2, (5, 7) = 2, (5, 8) = 2,
 (5, 9) = 2, (5, 10) = 1, (6, 1) = 2, (6, 2) = 2, (6, 3) = 2, (6, 4) = 2,
 (6, 5) = 2, (6, 6) = 2, (6, 7) = 2, (6, 8) = 2, (6, 9) = 2, (6, 10) = 1,
 (7, 1) = 2, (7, 2) = 2, (7, 3) = 2, (7, 4) = 2, (7, 5) = 2, (7, 6) = 2,
 (7, 7) = 2, (7, 8) = 2, (7, 9) = 2, (7, 10) = 1, (8, 1) = 2, (8, 2) = 2,
 (8, 3) = 2, (8, 4) = 2, (8, 5) = 2, (8, 6) = 2, (8, 7) = 2, (8, 8) = 2,
 (8, 9) = 2, (8, 10) = 1, (9, 1) = 2, (9, 2) = 2, (9, 3) = 2, (9, 4) = 2,
 (9, 5) = 2, (9, 6) = 2, (9, 7) = 2, (9, 8) = 2, (9, 9) = 2, (9, 10) = 1,
 (10, 1) = 2, (10, 2) = 2, (10, 3) = 2, (10, 4) = 2, (10, 5) = 2, (10, 6) = 2,
 (10, 7) = 2, (10, 8) = 2, (10, 9) = 2, (10, 10) = 1}):

m,n:=LinearAlgebra:-Dimensions(M):

Plines:=plots:-display(
  seq(seq(`if`(M[m+1-j,i-1]&amp;lt;&amp;gt;M[m+1-j,i],
               plottools:-line([i-0.5,j-1+0.5],[i-0.5,j+0.5]),NULL),
          j=1..m),i=2..n),
  seq(seq(`if`(M[m+1-j,i]&amp;lt;&amp;gt;M[m+2-j,i],
               plottools:-line([i-0.5,j-1+0.5],[i-0.5+1,j-1+0.5]),NULL),
          j=2..m),i=1..n),
              view=[1..m,1..n]):

Ppoints:=plots:-display(
  plots:-sparsematrixplot(Matrix(m,n,(i,j)-&amp;gt;M[m+1-i,j]-1),color=red),
  plots:-sparsematrixplot(Matrix(m,n,(i,j)-&amp;gt;M[m+1-i,j]-2),color=green)):

plots:-display( Plines, Ppoints );

&lt;/pre&gt;
&lt;!--break--&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=144020/454927/pointy.gif"&gt;&lt;img src="/view.aspx?sf=144020/454927/pointy.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;It's not clear what you want, exactly. But you may be able to adjust this to suit.&lt;/p&gt;
&lt;pre&gt;restart:

M:=Matrix(10, 10,
 {(1, 1) = 1, (1, 2) = 1, (1, 3) = 1, (1, 4) = 1, (1, 5) = 1, (1, 6) = 1,
 (1, 7) = 1, (1, 8) = 1, (1, 9) = 1, (1, 10) = 1, (2, 1) = 1, (2, 2) = 1,
 (2, 3) = 2, (2, 4) = 2, (2, 5) = 2, (2, 6) = 2, (2, 7) = 1, (2, 8) = 1,
 (2, 9) = 1, (2, 10) = 1, (3, 1) = 1, (3, 2) = 2, (3, 3) = 2, (3, 4) = 2,
 (3, 5) = 2, (3, 6) = 2, (3, 7) = 2, (3, 8) = 2, (3, 9) = 1, (3, 10) = 1,
 (4, 1) = 1, (4, 2) = 2, (4, 3) = 2, (4, 4) = 2, (4, 5) = 2, (4, 6) = 2,
 (4, 7) = 2, (4, 8) = 2, (4, 9) = 1, (4, 10) = 1, (5, 1) = 2, (5, 2) = 2,
 (5, 3) = 2, (5, 4) = 2, (5, 5) = 2, (5, 6) = 2, (5, 7) = 2, (5, 8) = 2,
 (5, 9) = 2, (5, 10) = 1, (6, 1) = 2, (6, 2) = 2, (6, 3) = 2, (6, 4) = 2,
 (6, 5) = 2, (6, 6) = 2, (6, 7) = 2, (6, 8) = 2, (6, 9) = 2, (6, 10) = 1,
 (7, 1) = 2, (7, 2) = 2, (7, 3) = 2, (7, 4) = 2, (7, 5) = 2, (7, 6) = 2,
 (7, 7) = 2, (7, 8) = 2, (7, 9) = 2, (7, 10) = 1, (8, 1) = 2, (8, 2) = 2,
 (8, 3) = 2, (8, 4) = 2, (8, 5) = 2, (8, 6) = 2, (8, 7) = 2, (8, 8) = 2,
 (8, 9) = 2, (8, 10) = 1, (9, 1) = 2, (9, 2) = 2, (9, 3) = 2, (9, 4) = 2,
 (9, 5) = 2, (9, 6) = 2, (9, 7) = 2, (9, 8) = 2, (9, 9) = 2, (9, 10) = 1,
 (10, 1) = 2, (10, 2) = 2, (10, 3) = 2, (10, 4) = 2, (10, 5) = 2, (10, 6) = 2,
 (10, 7) = 2, (10, 8) = 2, (10, 9) = 2, (10, 10) = 1}):

m,n:=LinearAlgebra:-Dimensions(M):

Plines:=plots:-display(
  seq(seq(`if`(M[m+1-j,i-1]&amp;lt;&amp;gt;M[m+1-j,i],
               plottools:-line([i-0.5,j-1+0.5],[i-0.5,j+0.5]),NULL),
          j=1..m),i=2..n),
  seq(seq(`if`(M[m+1-j,i]&amp;lt;&amp;gt;M[m+2-j,i],
               plottools:-line([i-0.5,j-1+0.5],[i-0.5+1,j-1+0.5]),NULL),
          j=2..m),i=1..n),
              view=[1..m,1..n]):

Ppoints:=plots:-display(
  plots:-sparsematrixplot(Matrix(m,n,(i,j)-&amp;gt;M[m+1-i,j]-1),color=red),
  plots:-sparsematrixplot(Matrix(m,n,(i,j)-&amp;gt;M[m+1-i,j]-2),color=green)):

plots:-display( Plines, Ppoints );

&lt;/pre&gt;
&lt;!--break--&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=144020/454927/pointy.gif"&gt;&lt;img src="/view.aspx?sf=144020/454927/pointy.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</description>
      <guid>144020</guid>
      <pubDate>Thu, 28 Feb 2013 22:54:25 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
    <item>
      <title>for fun</title>
      <link>http://www.mapleprimes.com/questions/144012-Plotting-An-Array?ref=Feed:MaplePrimes:Plotting an Array:Comments#comment144022</link>
      <itunes:summary>&lt;pre&gt;M:=LinearAlgebra:-RandomMatrix(13,13,generator=1..2);
&lt;/pre&gt;
&lt;!--break--&gt;
&lt;p&gt;Of course, for larger dimensions it should be built differently, more efficiently. (If your example was meant only as an illustrative toy example then you might consider using `implicitplot`. Or not..)&lt;/p&gt;
&lt;p&gt;I didn't state it before, but of course you could view Plines without Ppoints.&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>&lt;pre&gt;M:=LinearAlgebra:-RandomMatrix(13,13,generator=1..2);
&lt;/pre&gt;
&lt;!--break--&gt;
&lt;p&gt;Of course, for larger dimensions it should be built differently, more efficiently. (If your example was meant only as an illustrative toy example then you might consider using `implicitplot`. Or not..)&lt;/p&gt;
&lt;p&gt;I didn't state it before, but of course you could view Plines without Ppoints.&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</description>
      <guid>144022</guid>
      <pubDate>Thu, 28 Feb 2013 23:00:32 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
    <item>
      <title>modified</title>
      <link>http://www.mapleprimes.com/questions/144012-Plotting-An-Array?ref=Feed:MaplePrimes:Plotting an Array:Comments#comment144044</link>
      <itunes:summary>&lt;p&gt;I suppose that this has been done before... and likely done better too. But I may as well make it into a procedure.&lt;/p&gt;
&lt;pre&gt;restart:

cellplot:=proc(M::Matrix)
   local colorlist,m,n,i,j,Plines,Ppoints,v,vals;
   uses LinearAlgebra,plots,plottools;
   m,n:=Dimensions(M);
   Plines:=display(
      seq(seq(`if`(M[m+1-j,i-1]&amp;lt;&amp;gt;M[m+1-j,i],
                   line([i-0.5,j-1+0.5],[i-0.5,j+0.5]),NULL),
              j=1..m),i=2..n),
      seq(seq(`if`(M[m+1-j,i]&amp;lt;&amp;gt;M[m+2-j,i],
                   line([i-0.5,j-1+0.5],[i-0.5+1,j-1+0.5]),NULL),
              j=2..m),i=1..n),
      ':-view'=[1-0.48..m+0.48,1-0.48..n+0.48]);
   vals:=[{seq(v, v in M)}[]];
   colorlist:=setcolors();
   Ppoints:=display(
      seq(sparsematrixplot(Matrix(m, n,
                                  (i,j)-&amp;gt;`if`(M[m+1-i,j]=vals[k],1,0))
                           ,`if`(nops(colorlist)&amp;gt;=nops(vals),
                                 ':-color'=colorlist[k],NULL)
                           ,':-symbol'=':-solidcircle', tickmarks=[0,0]
                           ,':-symbolsize'=20, ':-legend'=vals[k]
                           , _rest),
          k=1..nops(vals)));
   display( Plines, Ppoints, ':-labels'=[``,``], ':-axes'=':-boxed' );
end proc:

A:=LinearAlgebra:-RandomMatrix(10,generator=-7..-5):

cellplot(A);

cellplot(A, legend=NULL, symbolsize=1);

cellplot(A, legend=NULL, symbol=solidbox, symbolsize=68); # not a great idea
&lt;/pre&gt;
&lt;!--break--&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;I suppose that this has been done before... and likely done better too. But I may as well make it into a procedure.&lt;/p&gt;
&lt;pre&gt;restart:

cellplot:=proc(M::Matrix)
   local colorlist,m,n,i,j,Plines,Ppoints,v,vals;
   uses LinearAlgebra,plots,plottools;
   m,n:=Dimensions(M);
   Plines:=display(
      seq(seq(`if`(M[m+1-j,i-1]&amp;lt;&amp;gt;M[m+1-j,i],
                   line([i-0.5,j-1+0.5],[i-0.5,j+0.5]),NULL),
              j=1..m),i=2..n),
      seq(seq(`if`(M[m+1-j,i]&amp;lt;&amp;gt;M[m+2-j,i],
                   line([i-0.5,j-1+0.5],[i-0.5+1,j-1+0.5]),NULL),
              j=2..m),i=1..n),
      ':-view'=[1-0.48..m+0.48,1-0.48..n+0.48]);
   vals:=[{seq(v, v in M)}[]];
   colorlist:=setcolors();
   Ppoints:=display(
      seq(sparsematrixplot(Matrix(m, n,
                                  (i,j)-&amp;gt;`if`(M[m+1-i,j]=vals[k],1,0))
                           ,`if`(nops(colorlist)&amp;gt;=nops(vals),
                                 ':-color'=colorlist[k],NULL)
                           ,':-symbol'=':-solidcircle', tickmarks=[0,0]
                           ,':-symbolsize'=20, ':-legend'=vals[k]
                           , _rest),
          k=1..nops(vals)));
   display( Plines, Ppoints, ':-labels'=[``,``], ':-axes'=':-boxed' );
end proc:

A:=LinearAlgebra:-RandomMatrix(10,generator=-7..-5):

cellplot(A);

cellplot(A, legend=NULL, symbolsize=1);

cellplot(A, legend=NULL, symbol=solidbox, symbolsize=68); # not a great idea
&lt;/pre&gt;
&lt;!--break--&gt;
&lt;p&gt;acer&lt;/p&gt;</description>
      <guid>144044</guid>
      <pubDate>Fri, 01 Mar 2013 07:43:01 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
    <item>
      <title>pretty!</title>
      <link>http://www.mapleprimes.com/questions/144012-Plotting-An-Array?ref=Feed:MaplePrimes:Plotting an Array:Comments#comment144051</link>
      <itunes:summary>&lt;p&gt;&amp;nbsp;&lt;a href="http://www.mapleprimes.com/questions/144012-Plotting-An-Array#comment144044"&gt;@acer&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;and no doubt useful too!&lt;/p&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=144051/454983/acer1.jpg"&gt;&lt;img src="/view.aspx?sf=144051/454983/acer1.jpg" alt=""&gt;&lt;/a&gt;&lt;a href="/view.aspx?sf=144051/454983/acer2.jpg"&gt;&lt;img src="/view.aspx?sf=144051/454983/acer2.jpg" alt=""&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;&amp;nbsp;&lt;a href="http://www.mapleprimes.com/questions/144012-Plotting-An-Array#comment144044"&gt;@acer&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;and no doubt useful too!&lt;/p&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=144051/454983/acer1.jpg"&gt;&lt;img src="/view.aspx?sf=144051/454983/acer1.jpg" alt=""&gt;&lt;/a&gt;&lt;a href="/view.aspx?sf=144051/454983/acer2.jpg"&gt;&lt;img src="/view.aspx?sf=144051/454983/acer2.jpg" alt=""&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;</description>
      <guid>144051</guid>
      <pubDate>Fri, 01 Mar 2013 14:21:34 Z</pubDate>
      <itunes:author>PatrickT</itunes:author>
      <author>PatrickT</author>
    </item>
  </channel>
</rss>