Colormap, mask data
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello!
I'm processing some data and I want to improve the Figure 1 attached.
If I understood correctly, I can convert the NaN values to zero, and then I have the same blue tone.
If this is correct, how can I do that?
Or perhaps can I change the colormap scheme?
Basically I want the blue with the same tone, and keep the orange and yellows.
That is my real data, everything around is noise.
Thanks in advance!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/269091/image.jpeg)
댓글 수: 0
답변 (1개)
Raphael Pesch
2020년 1월 30일
Hey,
It seems as if you want the light blue and dark blue elements in the same colour. I am not sure if there is a function to do this automatically, but you could solve the problem by implementing two loops. If the values that you want to bring to zeros are NaN-values, than you can detect them with the isnan command (https://de.mathworks.com/help/matlab/ref/isnan.html).
If the values that you look for is light blue, than you should bring all of those values to zero. In the picture you uploaded it seems as if the light blue values are noise values with a maximum value of 0.15, so you could bring all values that are lower than this to zero.
I guess all your values lie in a matrix. Lets say this matrix is called testMatrix, than you can use this code:
[n,m] = size(testMatrix)
testMatrixWithoutNoise = zeros(n,m)
for i = 1:n
for j = 1:m
if isnan(testMatrix(i,j))
testMatrixWithoutNoise(i,j) = 0;
else if testMatrix(i,j) <= 0.15
testMatrixWithoutNoise(i,j) = 0;
else
testMatrixWithoutNoise(i,j) = testMatrix(i,j)
end
end
end
And now all the noise and NaN values should be gone and you can colormap the Matrix testMatrixWithoutNoise.
I hope this is helpfull. :-)
Have a nice day!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Colormaps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!