2D density plot with colorbar
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Farai Mahachi
am 9 Mai 2019
Bearbeitet: Farai Mahachi
am 9 Mai 2019
Hi guys,
I have data which has produced a 2D plot as shown in the first figure.
How can I transform the above figure to appear like the one below?
0 Kommentare
Akzeptierte Antwort
KSSV
am 9 Mai 2019
Bearbeitet: KSSV
am 9 Mai 2019
N = 100 ;
x = linspace(0,2*pi,N)' ;
y = sin(x) ;
xi = linspace(min(x),max(x),N) ;
yi = linspace(min(y)-1,max(y)+1,N) ;
[X,Y] = meshgrid(xi,yi) ;
Z = zeros(size(X)) ;
idx = knnsearch([X(:) Y(:)],[x y]) ;
Z(idx) = 1 ;
Z(idx+1) = 1 ;
Z(idx-1) = 1 ;
pcolor(X,Y,Z)
shading interp
colorbar
colormap(jet)
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Time-Frequency Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!