colorbar's color failed with colormap longer than 1024 in scatter
Show older comments
I try to make a scatter plot and I have found out a problem with ploting colorbar, when length of x, y vectors and colormap is greater than 1024. I don't get errors, just the colorbar becomes grey.
This is a code which I run:
rnd = randn(2000,1);
idx = randi([1 1280],2000,1);
idy = randi([1 1024],2000,1);
l=1024;
figure;
markerSize=50;
map=colormap(jet(length(rnd(1:l))));
scatter(idx(1:l),idy(1:l),markerSize,map,'fill');
colorbar;
I change the length of these vectors and matrix with a parameter called 'l'. Now it is 1024 and I get a correct colorbar:

when I will change l for 1025 I get a grey colorbar:

What is the problem and how to solve it? I test Matlab R2014b Trial on Windows 7 Home Premium 64-bit. I have not found limitations of trial version on the mathworks webpage.
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!