colorbar in 3d patch

조회 수: 2 (최근 30일)
zawaiter
zawaiter 2012년 2월 6일
hi, iam using this function http://www.mathworks.cn/matlabcentral/fileexchange/28497-plot-a-3d-array-using-patch to plot 3D array,it did a great job,but since most of my data are in the range from 0 to 4,i wish i can edit the colorbar and fix it is upper and lower limits to 0 and 4,then any data value bigger than 4 mapped to 4,and data value less than zeros mapped to zero.i would like this change to compare my data values with color.plz some help

답변 (2개)

Walter Roberson
Walter Roberson 2012년 2월 6일
How about if you use
DataToPlot = min( max(YourData, 0), 4);
This will restrict your data to that range before going in to the plotting routine, which would be easier than editing the plotting routine.

zawaiter
zawaiter 2012년 2월 7일
THANK YOU ROBERSON SO MUCH FOR ALL THE HELP,the problem is that my data have nans also and i want them to remain nans for 3d display.so i need something more like mydata(mydata > 4)=4; mydata(mydata < 0 && mydata ~=nan)=0; but i always get matlab error saying ??? Operands to the and && operators must be convertible to logical scalar values. any ideas?

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by