How can I "connect" the colorbar to my values of a scatter plot?
36 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sim
il 22 Giu 2024 alle 20:31
Commentato: Star Strider
il 24 Giu 2024 alle 13:14
How can I "connect" the colorbar to my values (between 0 and 1) of a scatter plot?
a = rand(1000,1);
C = 1-[a a a];
scatter(1:length(a),a,60,C,'fill')
colormap(C);
colorbar;
Here you can see that the colorbar is not gradually changing from 0 to 1.. How to fix it?
0 Commenti
Risposta accettata
Star Strider
il 22 Giu 2024 alle 20:58
I am not certain what you want to do, or what you intend by ‘connect’.
One option —
a = rand(1000,1);
% C = 1-[a a a];
C = ([1;1;1]*linspace(1, 0, 1000)).';
scatter(1:length(a),a,60,C,'fill')
colormap(C);
colorbar;
.
6 Commenti
Star Strider
il 24 Giu 2024 alle 13:14
As always, my pleasure!
No worries! Often, these sorts of mathematical concepts are difficult to describe.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Blue in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!