Re: 3D table plot Pbs
- To: mathgroup at smc.vnet.net
- Subject: [mg13195] Re: [mg13121] 3D table plot Pbs
- From: Tomas Garza <tgarza at mail.internet.com.mx>
- Date: Mon, 13 Jul 1998 07:42:44 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Lotfi BAGHLI wrote:
>Please, I would like you to tell me how can we plot in 3D a Table
>z=f(x,y).
>I don't want to have the fellowinf format : ( which uses i and j )
> ListPlot3D[ Table[ z[i][j], {i,0,8},{j,0,4}]]
>In fact, I want to plot
> Table[ {x[i],y[j],z[i][j]}, {i,0,8},{j,0,4}]
>I want to use the x[i] and y[j] for the axes.
This question was posed in mg11879. Please refer to mg11986 and other
answers. The general idea goes as follows (I quote from my own
mg11986):
"ListPlot3D plots the heights z corresponding to points of a
three-dimensional array in the plane xy. I assume that your data are
the list of values (X,Y,Z), where Z is the height corresponding to the
pair (X,Y).
You have to construct a grid in the xy plane where x varies between min
X and max X, and y varies between min Y and max Y, in order to get an
array of m values of x and n values of y, say.
Then, for each value of x in the array, take the list of heights z
corresponding to the consecutive values of y (you may have to fill
in zeros, if necessary). You end up with the list h = {z11,
z12,..., z1n}, {z21, z22,...,z2n},...,{zm1,zm2,...,zmn}} .
ListPlot3D[h] will give the 3D plot you are looking for. However, it
will assign the values 1,2,...m and 1,2,..n, respectively, to the
consecutive points along the x and y coordinates, so that you will
have to relabel those points according to the actual values in your
data. This should be no trouble using the TickMarks option."
Other related answers are also helpful.
Good luck,
Tomas Garza
Mexico City