Re: Problem with Mesh for MatrixPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg89803] Re: Problem with Mesh for MatrixPlot
- From: "David Park" <djmpark at comcast.net>
- Date: Sat, 21 Jun 2008 05:29:00 -0400 (EDT)
- References: <g3fvte$krt$1@smc.vnet.net>
Does using Normal on the SparseArray give what you want? n1 = 13; n2 = 15; ntot = n1 n2; mymat = SparseArray[{Band[{1, 1}] -> 0.87, Band[{1, 2}] -> -0.3, Band[{2, 1}] -> 0.3}, {ntot, ntot}] // Normal; MatrixPlot[mymat, Mesh -> {Table[n2*i, {i, 1, n1 - 1}], Table[n2*i, {i, 1, n1 - 1}]}] -- David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ "Thibaut Jonckheere" <Thibaut.Jonckheere at cpt.univ-mrs.fr> wrote in message news:g3fvte$krt$1 at smc.vnet.net... > > Dear group, > > I have a large matrix, which has a block structure. In a MatrixPlot of > the matrix, I want to show the blocks by plotting mesh lines at the > block boundaries only. However, this seems to work well only for small > matrices, and not for larger matrices. > > Here is a simple example showing the problem: > > n1 = 3; n2 = 5; > ntot = n1 n2; > mymat = SparseArray[{Band[{1, 1}] -> 0.87, Band[{1, 2}] -> -0.3, > Band[{2, 1}] -> 0.3}, {ntot, ntot}]; > MatrixPlot[mymat, > Mesh -> {Table[n2*i, {i, 1, n1 - 1}], Table[n2*i, {i, 1, n1 - 1}]}] > > > With these small values of n1 and n2, the result is as expected,showing > the 5x5 blocks. However, when I increase the values of n1 and n2 (for > example n1=13 and n2 =15), the meshlines are not shown on the whole > matrice width (they don't go further than approx. 90). > > Note that the problem is also visible with the simple command: > MatrixPlot[mymat, Mesh -> All]. > > > Is there something I am doing wrong, or is this a bug in the Mesh option > of MatrixPlot ? > > Thank you for your help. > > > Thibaut Jonckheere > > NB: I use Mathematica 6.0.1.0 on Win Xp (32 bit), and also on Linux, and > the problem is present in both cases. > > -- > ---------------------------------------------------------------------------- > Thibaut Jonckheere > Centre de Physique Theorique > Campus de Luminy, case 907 > 13288 Marseille cedex 9 > tel: (+33).4.91.26.95.36 > email: jonckhee at cpt.univ-mrs.fr > web: http://www.cpt.univ-mrs.fr/~jonckheere > ---------------------------------------------------------------------------- > > >