필터 지우기
필터 지우기

How can I make a logarithmic color plot and colorbar

조회 수: 92 (최근 30일)
Robin Ramstad
Robin Ramstad 2018년 4월 6일
댓글: Walter Roberson 2018년 11월 21일
When working in Matlab 2014a I had a work-around to make logarithmic colorbars for my pcolor plots, making figures such as below.
After an institutional change to Matlab 2018a this workaround is completely broken, and it seems logarithmic colorbars with minor tickmarks are still not natively supported despite being a common type of plot. Is there any method to create this type of plot and colorbar in the newer releases?

답변 (2개)

Jeffrey Lestz
Jeffrey Lestz 2018년 8월 10일
I have version 2018a, and the following also works for me:
set(gca,'colorscale','log')
  댓글 수: 3
Walter Roberson
Walter Roberson 2018년 8월 22일
This was introduced in R2018a.
nlm
nlm 2018년 11월 20일
How to get logarithmic scale colors on graph but linear colorbar ?

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2018년 4월 6일
cb = colorbar();
cb.Ruler.Scale = 'log';
cb.Ruler.MinorTick = 'on';
  댓글 수: 6
Jonah Pearl
Jonah Pearl 2018년 11월 20일
Thank you, this works! @Antoine, your error is because you have some data equal to 0 in the Z-direction, and since log(0) is -Inf, the transform fails. Adding a very small number like 0.0001 to your Z-data should fix this. Or you could add in an if statement, if data == 0, add 0.0001.
Walter Roberson
Walter Roberson 2018년 11월 21일
Jonah, the error message Antoine shows depends on version . It was a limitation between r2014b and r2017b that did not depend upon data being 0.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Purple에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by