How to add both title and change the scale of a color bar

조회 수: 1 (최근 30일)
Matthew Backert
Matthew Backert 2020년 2월 5일
답변: Sindar 2020년 2월 5일
I am trying to add a title to the colorbar of a contour plot but also change the scaling of the colorbar. All I have found online is instructions for one or the other. When I have this:
title(colorbar, 'Electric Potential Field, V');
caxis([-45 150]);
set(colorbar, 'YTick', -45:15:150);
I get the scale I want but not the title. If I put the title command afterward I lose the scaling. Is there a command that I can use to have both?

채택된 답변

Sindar
Sindar 2020년 2월 5일
cb=colorbar();
cb.Label.String = 'Electric Potential Field, V';
cb.Ticks = -45:15:150;
caxis([-45 150]);

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by