Need help with Scatter and colorbar,

5 vues (au cours des 30 derniers jours)
Ale
Ale le 22 Juin 2017
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...

Réponses (2)

Walter Roberson
Walter Roberson le 23 Juin 2017
Modifié(e) : Walter Roberson le 23 Juin 2017
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 le 9 Jan 2019
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

Catégories

En savoir plus sur Scatter Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by