how to display colorbar levels from '-10^6' to '10^6' ?

2 visualizaciones (últimos 30 días)
SHANMUKHA REDDY AMARAVADI
SHANMUKHA REDDY AMARAVADI el 15 de Oct. de 2018
Editada: Adam el 16 de Oct. de 2018
labels=arrayfun(@(c1_Positive)['10^',int2str(c1_Positive)],c1_Positive,'uniformoutput',false);
set(ax1,'TickLabels',labels);
labels2=arrayfun(@(c1_Negative)['-10^',int2str(c1_Negative)],c1_Negative,'uniformoutput',false);
set(ax1,'TickLabels',labels2);
  2 comentarios
Adam
Adam el 15 de Oct. de 2018
What are you trying to achieve and in which version of Matlab?
caxis( [-10^6 10^6] )
will set the colourbar range to that. I don't know what you are trying to do in your code though since you are assigning labels to an axes, and then overwriting them with another set.
In recent versions of Matlab a colourbar is an object rather than an axes explicitly.
SHANMUKHA REDDY AMARAVADI
SHANMUKHA REDDY AMARAVADI el 16 de Oct. de 2018
I have a contour of count data having minimum number being -10^5 and maximum number being in 10^5. I want my colorbar to show these '10^' levels (which makes it easy to identify the number of counts) both positive and negative. I am using matlab 2016b

Iniciar sesión para comentar.

Respuestas (1)

Adam
Adam el 16 de Oct. de 2018
Editada: Adam el 16 de Oct. de 2018
c = colorbar;
labels=arrayfun(@(c)['10^',int2str(c)],-6:6,'uniformoutput',false);
set( c, 'TickLabels', labels, 'TickLabelInterpreter', 'none' );
works, but the result is ugly and far less readable than the default way of presenting the information.

Categorías

Más información sobre Colorbar 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!

Translated by