Need help with Scatter and colorbar,

5 次查看(过去 30 天)
Hi! Why is the colorbar unavailable for variable z in a scatter plot?
z are values from 1000 to 4000, and I want a colorbar from those values (matrix 513x1) I've trying with a imagesc(z), get the colorbar and use it; also, I tried with hsv2rgb, etc... but I can't...

回答(2 个)

Walter Roberson
Walter Roberson 2017-6-23
编辑:Walter Roberson 2017-6-23
x = randi(25,1,10); y = randi(25,1,10); z = randi([1000,4000],1,10);
scatter(x,y,30,z) %30 is point size
colorbar
works fine for me.

Zahra Sharifnezhadazizi
bins=200;
n = hist3(St,[bins bins]); % Extract histogram data;
% % % default to 10x10 bins
n1 = n';
n1( size(n,1) + 1 ,size(n,2) + 1 ) = 0;
% Generate grid for 2-D projected view of intensities:
% n = EE-EE3;
% n1=n';
xb = linspace(min(dat(:,1)),max(dat(:,1)),size(n,1)+1);
yb = linspace(min(dat(:,2)),max(dat(:,2)),size(n,1)+1);
%Make a pseudocolor plot:
n1(n1<3)=nan;
imagesc(xb,yb,n1); axis xy

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by