Contour-plot - Delete lines in legend colorbar

조회 수: 4 (최근 30일)
Mepe
Mepe 2021년 6월 25일
댓글: Mepe 2021년 6월 25일
The colorbar for a logarithmic contour plot shows many small intermediate lines that I would like not to include. Can this be removed?

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2021년 6월 25일
If you keep track of the handle returned by colorbar then it is easy to supress the ticks:
cbh = colorbar;
set(cbh,'TickLength',0.00)
However, I find these tickmarks very helpful to guide the eyes - especially for plots on logarithmic scales (but this is obviously a design choise depending on personal preferences).
HTH
  댓글 수: 3
Bjorn Gustavsson
Bjorn Gustavsson 2021년 6월 25일
It is not clear what you mean by "integrated ticks". But if you want to manually set what levels you want tick-marks at you can do so:
figure
contourf(log10(peaks(123).^2))
cbh = colorbar;
set(cbh,'Ticks',[-10 -7 -5 -3 -1 0])
In general you can get a grasp of what properties of a graphics object you can set by doing (in this case for the colorbar):
set(cbh)
From there on you can pretty much try-n-test your way forward and see what works and what suits your needs and tastes.
Mepe
Mepe 2021년 6월 25일
Perfect, thanks!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by