Need help with Scatter and colorbar,

3 ビュー (過去 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 Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by