Need help with Scatter and colorbar,

조회 수: 4 (최근 30일)
Ale
Ale 2017년 6월 22일
답변: Zahra Sharifnezhadazizi 2019년 1월 9일
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
Zahra Sharifnezhadazizi 2019년 1월 9일
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