Re: ListContourPlot3D bug?
- To: mathgroup at smc.vnet.net
- Subject: [mg102328] Re: [mg102285] ListContourPlot3D bug?
- From: "David Park" <djmpark at comcast.net>
- Date: Wed, 5 Aug 2009 05:46:31 -0400 (EDT)
- References: <26453615.1249376414974.JavaMail.root@n11>
This is certainly somewhat confusing and counterintuitive. But there is a certain method to the madness. Iterators in continuous plots do not behave the same way as plots produced from Tables of values. The best way to think of it is that plots that work from arrays of values produce a representation that looks like the physical picture of the array. Consider the following data for an ArrayPlot: data0 = Table[x, {x, 0, 1, .2}, {y, 0, 1, .2}] {{0.,0.,0.,0.,0.,0.}, {0.2,0.2,0.2,0.2,0.2,0.2}, {0.4,0.4,0.4,0.4,0.4,0.4}, {0.6,0.6,0.6,0.6,0.6,0.6}, {0.8,0.8,0.8,0.8,0.8,0.8}, {1.,1.,1.,1.,1.,1.}} The physical picture is that the variation occurs in the vertical direction. Remembering that in ArrayPlot 0s appear as White and 1s appear as Black (another confusion) we obtain the following plot. ArrayPlot[data0] To obtain the x gradient that one might expect we have to use: ArrayPlot[Transpose[data0]] In the same way, with ListContourPlot3D, it is necessary to Transpose the data. data1 = Transpose[ Table[x^2 + y^2, {x, -1, 1, 0.1}, {y, -1, 1, 0.1}, {z, -1, 1, 0.1}], {3, 2, 1}]; ListContourPlot3D[data1, Contours -> {0.1}, Mesh -> None, AxesLabel -> {x, y, z}] It might be more intuitive to use the second form of ListContourPlot3D. But here we have to Flatten the data. data2 = Flatten[ Table[{x, y, z, x^2 + y^2}, {x, -1, 1, 0.1}, {y, -1, 1, 0.1}, {z, -1, 1, 0.1}], 2]; ListContourPlot3D[data2, Contours -> {0.1}, Mesh -> None, AxesLabel -> {x, y, z}] David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: markus [mailto:markusg.phys at googlemail.com] Hi, I think I've found a bug in the ListContourPlot3D function (Mathematica 7.01): the following command should give a cylinder along the z-axis: ListContourPlot3D[ Table[x^2 + y^2, {x, -1, 1, 0.1}, {y, -1, 1, 0.1}, {z, -1, 1, 0.1}], Contours -> {0.1}, Mesh -> None, AxesLabel -> {x, y, z}] However, the cylinder is aligned along the x-axis, which is not correct. The command ContourPlot3D[x^2 + y^2, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, Contours -> {0.1}, Mesh -> None, AxesLabel -> {x, y, z}] gives the correct output. Of course, for a single plot like above, the solution would be just to exchange the axes label. But this becomes awkward when you, for example, want to combine multiple plots (via Show). -Markus