Removing Extreme Value from Colorbar

11 次查看(过去 30 天)
I am working with a 3D scatter plot that is mapping the X,Y, and Z positions of a certain body, the time spent at each point is represented by the the intensity of the color dictated by a colormap. My code works and the color bar also works, however there are few extreme values that skew the color bar thus reducing the usefulness of it.
How can I remove these extreme values from the colorbar yet plot them? I understand the sizes of the arrays should be the same, and I cannot remove the entries from my array as they are important to 3D scatter plot
scatter3(X , Y , Z ,15,time)
newmap = parula(100);
ncol = size(newmap,1);
zpos = 1 + floor(0);
newmap(zpos,:) = [1 0 0];
colormap(newmap);
h=colorbar;

采纳的回答

vik
vik 2019-2-1
You can set the colormap limits for the current axes by using caxis:
caxis([-5,50])
Values below or above these limits will be colored with the color according to the last or first value of your colormap.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

产品


版本

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by