PDA

View Full Version : Matlab 3D Scatter Plot


ASidebottomIU
Jul16-11, 07:12 PM
Hello

I am very new to Matlab and need help on importing my data for a 3D plot. Currently, I have x,y,z data that I am trying to import to look like Figure 5 in the following paper:

http://www.nature.com/nmeth/journal/v4/n5/fig_tab/nmeth1038_F5.html

I have no idea how to import the data from an excel file- any help would be appreciated. Thank you!

Ashley
IU Chemistry

viscousflow
Jul17-11, 01:16 AM
investigate the function xlsread

help xlsread

ASidebottomIU
Jul17-11, 10:47 AM
The issue is that I am not sure what the extra 's' and 'c' fields are that are required for Scatter3 (x,y,z,s,c). I want to relate both x and y to z- an actual step-by-step would be most helpful as I am struggling to relate the script to the plot tools gui.

Ashley

MisterX
Jul17-11, 04:24 PM
The issue is that I am not sure what the extra 's' and 'c' are...


S may be used to set the size of the dots on the scatter plot, and C may be used to set the color of the points. You can to learn this yourself using MatLab documentation.

But scatter3 will not produce a plot like either Figure5 a) or Figure 5 b).

To produce a plot like figure 5 a), you could use surface(X,Y,Z) (http://www.mathworks.com/help/techdoc/ref/surface.html), with the jet colormap (http://www.mathworks.com/help/techdoc/ref/colormap.html).

Figure 5. b) is 2d so one would just use scatter(X,Y,S,C) (http://www.mathworks.com/help/techdoc/ref/scatter.html) to get something similiar. You could use multiple calls to scatter with "hold on;" to plot the different colors or dot sizes.

ASidebottomIU
Aug2-11, 05:53 PM
Thank you MisterX for your reply- it definitely helped and I have figured it out!