-3

I generated a scatter plot with scatter3 function in MATLAB. I need to change the marker size in the plot.Right now I am using a basic code that goes as follow:

data=importdata('clean_data_1_trial.csv');
x=data(:,1);
y=data(:,2);
z=data(:,5);
scatter3(x,y,z,[],z,'filled');
xlabel('Easting');
ylabel('Northing');
zlabel('Height');
title('3d scatter plot of B1')

How can i change the marker size.

wibeasley
  • 5,000
  • 3
  • 34
  • 62
shivi
  • 1
  • Welcome - please read how to ask -http://stackoverflow.com/help/how-to-ask. Proof read before posting! you have a typo in your heading. Also search this has been asked before! – micstr Aug 19 '16 at 09:08

1 Answers1

1

According to this docummentation

scatter3(X,Y,Z,S) 

draws the markers at the specified sizes (S) with a single color.

And example:

[x,y,z] = sphere(16);
X = [x(:)*.5 x(:)*.75 x(:)];
Y = [y(:)*.5 y(:)*.75 y(:)];
Z = [z(:)*.5 z(:)*.75 z(:)];
S = repmat([1 .75 .5]*10,prod(size(x)),1);
C = repmat([1 2 3],prod(size(x)),1);
scatter3(X(:),Y(:),Z(:),S(:),C(:),'filled'), view(-60,60)

To summarize, you need to use a matrix s, instead of []

size = [1 1 1];
s = repmat(size , prod(size(x)),1);