Logarithmic colorscale ? Contourf, large range of value
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Cyril GADAL
el 3 de Mayo de 2017
Respondida: Harsh
el 11 de Mayo de 2017
Hello,
I'm currently trying to plot Data using contourf(X,Y,Z), where Z values are ranging from 0.01 to -1.6. I'm using the jet colorbar. However, what is interesting to see is between 0 and 0.01, so I would like to have a detailed colorbar between 0 and 0.01, and a small variation between 0 and -1.6. Basically, I would like that the positive values scale in red and the negatives one in blue.
I thought using a logarithmic scaling would help, but it's currently expending the blue and reducing the red, and not giving at all what I want. I used :
cmap = jet
redMap = cmap(:,1);
greenMap = cmap(:,2);
blueMap = cmap(:, 3);
newX = logspace(0, log10(64), 64);
logRedMap = interp1(1:64, redMap, newX);
logGreenMap = interp1(1:64, greenMap, newX);
logBlueMap = interp1(1:64, blueMap, newX);
logMap = [logRedMap; logGreenMap; logBlueMap]';
colormap(logMap);
Note that everything would be super easy if I only had positive values, so I could take the log of my data and it would be ok.
Thanks for the advices.
This is with the natural colormap/colorscale.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163710/image.png)
And this is when i set everything negative value to zero, so i can see what is interesting. But this solution isn't very satisfying.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163712/image.png)
This one is after the code I wrote before :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163714/image.png)
0 comentarios
Respuesta aceptada
Harsh
el 11 de Mayo de 2017
Hello Cyril,
If you still need help with this, please contact MathWorks Technical Support here: https://www.mathworks.com/support/contact_us/
Please be sure to provide a detailed description of the issue and attach any relevant files / code / examples required to investigate the issue.
0 comentarios
Más respuestas (1)
Chaitral Date
el 8 de Mayo de 2017
Please share your data in order to assist you further.
0 comentarios
Ver también
Categorías
Más información sobre Blue 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!