How to use two seperate colorbars on the same plot.
Mostrar comentarios más antiguos
Hello,
I am trying to make topographic map, using data from above and below the sea surface. I want to use two different colormaps, one for above the sea surface(positive z values) and one for below the sea surface(negative z values). Any help would be greatly appreciated.
Max
Respuestas (1)
You don't need two different colourmaps for that - you can join together two colourmaps yourself into a single one e.g.
cmap = [ summer(256); hot(256) ];
figure; imagesc( rand(100) - 0.5 );
colormap( gca, cmap );
You can do the same obviously with custom colourmaps or just create your own colourmap in any way you want.
You just need to ensure that you keep a symmetric colour range e.g.
clims = [-1 1] * max( abs( myData(:) ) );
caxis( hAxes, clims );
for some data, myData, and for an axes handle hAxes
2 comentarios
Max Campbell
el 22 de Jun. de 2017
Editada: Max Campbell
el 22 de Jun. de 2017
Adam
el 22 de Jun. de 2017
You can play around with where you concatenate colourmaps if you wish, but it does get complicated - e.g. you can concatenate a colourmap of size 32 with a colourmap of size 128 to achieve an assymetric total colourmap, but you would have to work out the maths for what size you would need for each portion of the colourmap in that case.
in your case I guess you need the negative part of the colourmap to be 50 times bigger than the positive part if you fix the clims to [-5000 100]
Categorías
Más información sobre Orange en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!