[newbie] Plotting an array



On Dec. 17, 2008, Victor Stabile wrote:
-----------------------
I'm solving Laplace's equation iterating the cells of an
array to have the mean value of the cells around it.
It worked just fine, but I really can't figure out how
I'm supposed to plot the result (paint the cells
accordingly to their value). Can I actually do that? How?
--------------------------------------------------
Here is one approach using draw2d. See draw2d
examples to play with palette choices.

 display2d : false$

 cellval :  [ [1, 2, 3, 4, 5], [2, 3, 4, 5, 4],
        [0, 1, 2, 3, 4], [0, 0, 1, 2, 3], [0, 0, 0, 1, 2 ]  ]$

mcell : apply ( 'matrix, cellval );   ---->
    matrix ( [1, 2, 3, 4, 5], [2, 3, 4, 5, 4], [0, 1, 2, 3, 4],
                                            [0, 0, 1, 2, 3], [0, 0, 0, 1, 
2] )
load(draw)$

draw2d ( palette = [1, 3, 8],
             image ( mcell,  0,  0,  5,  5 ) )$

====================
this produces a density plot in "sort of blue" shades
with five rows and five columns.

Ted Woollett