How can I "connect" the colorbar to my values of a scatter plot?
7 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Star Strider
2024-6-22
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 个评论
Star Strider
2024-6-24
As always, my pleasure!
No worries! Often, these sorts of mathematical concepts are difficult to describe.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Scatter Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!