I want to do a scatter plot with points in different colors in the following way (Using Matlab 2018b).
colormap = jet(256);v = rescale(pwdb, 1, 256); numValues = length(pwdb);markerColors = zeros(numValues, 3);figurefor k = 1 : numValues row = round(v(k)); markerColors(k, :) = colormap(row, :);endscatter(location(1,:), location(2,:), [], markerColors,'filled');
This works fine, the points are plotted with the right colors.
However, when I try to add the colorbar (with ), I get the following:
colorbar
What is the way to include the color red in the bar and the right values?
Thanks
Best Answer