Matlab: how to set a logarithmic scale on a coutour plot

I have some data that I want to display in the form of a contour graph with a logarithmic scale of values ​​(matrix Z) and labeled counters. Here is how I do it:

[C, h1] = contourf(X, Y, log(Z)); 
clabel(C,h1);

Here is my result:

image

My question is: how can I get the correct marks on the contours? I do not need a color bar as described here .

Edit: Here is my example:

X = 1:1:20;
Y = X; 
Z = zeros(size(Y));
for i = 1:size(Y,2);
    Z(i, :) = 10^i;
end

[C, h1] = contourf(X, Y, Z); 
clabel(C,h1);

My true data looks like this: true

I can set any labels for the countour labels that I want, but they won’t be visible because my data is exponential (And by the way, the labels that are visible on this graph are true, the ones I want go to the next plot).

, , ( Z), . ( , , , , ):

[C, h1] = contourf(X, Y, log(Z)); 
clabel(C,h1);

: logdtata

- , . . , :

  • 0: 5: 45 - , .
  • 10 ^ [0: 5: 45] ( ). (0, 45) ( ). , ( ) , , .

- :

[C, h1] = contourf(X, Y, Z, 'ZScale', 'Log'); 
clabel(C,h1);

10, 10 ^ 5, 10 ^ 10 ..

, :

  • Matlab .

  • , (new_label = 10 ^ old_label).

+4
1

"Hack", , , clabel(C,h1):

. , , 1,10,... .., 10 , :

nextpow10Z=ceil(log10(max(Z(:))));

contourf :

[C,h1]=contourf(X,Y,log10(Z),1:nextpow10Z);

clabel(C,h1); clabel, ( , ):

tl=clabel(C);

enter image description here

, tl, , Data, Text Line.

Type Text, tl:

TextElements=findobj(tl,'Type','Text');

, N 1EN:

for i=1:length(TextElements)
    TextElements(i).String=strcat('1E',TextElements(i).String);
end

!

enter image description here

+2

All Articles