Colormap, mask data
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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!
0 comentarios
Respuestas (1)
Raphael Pesch
el 30 de En. de 2020
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 comentarios
Ver también
Categorías
Más información sobre Colormaps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!