Is there any way of producing a 4d plot from a matrix which has 4 columns (coordinates + value)?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm trying to produce a volume plot from a matrix that has 4 columns: x_coordinate, y_coordinate, z_coordinate and the value of the variable I'm working with.
It's something like this, assuming that my volume is 3x3x3:
x | y | z | value
0 0 0
0 0 1
0 0 2
0 1 0
0 1 1
0 1 2
0 2 0
0 2 1
0 2 2
1 0 0
1 0 1
1 0 2
1 1 0
1 1 1
1 1 2
1 2 0
1 2 1
1 2 2
2 0 0
2 0 1
2 0 2
2 1 0
2 1 1
2 1 2
2 2 0
2 2 1
2 2 2
At this moment, I'm trying to use 'surf' to do that, but I don't have any idea of how to build my code to convert the coordinates system I have into vectors that can be used without losing my 'value' information. I wanted to know if there's any function that can deal with information organized this way or maybe some simple idea of how to build the code.
Thanks, David
0 comentarios
Respuestas (1)
W. Owen Brimijoin
el 22 de Jul. de 2014
It's generally difficult to provide an intuitive graphical representation of high dimensional data. But, and mind you I say this without seeing your dataset, you could try using:
scatter3(x,y,z,S,'filled')
Where S (the size of the markers) is the vector of values* from your fourth column. This will result in a 3D grid of points of different sizes, so you could rotate this plot and see regions in your 3D space that had larger values associated with them.
. .
*You will probably need S to actually be some function of those values, because I believe the units in S are specified as number of pixels, rather than in axis coordinates.
2 comentarios
W. Owen Brimijoin
el 22 de Jul. de 2014
No I simply meant that the numbers in data(:,4) might be negative (which from the error you are getting might be the case), or might have a dynamic range that wouldn't work well for specifying the size of a dot. So you might have to make another variable, say,
dot_sizes = data(:,4) - min(data(:,4)) %getting rid of the -values
scatter3(data(:,1),data(:,2),data(:,3),dot_sizes,'filled')
Then if the resulting dots are either way too big, or way to small you might have to scale them somehow:
scatter3(data(:,1),data(:,2),data(:,3),dot_sizes*scale_value,'filled')
I don't know what your data is like, you might have a value of 10,000 in there somewhere and that'd be a really big dot on a graph.
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!