필터 지우기
필터 지우기

Error setting property 'YLabel' of class 'Axes':

조회 수: 59 (최근 30일)
hans
hans 2022년 6월 29일
댓글: Voss 2022년 6월 29일
I'm getting the error message:
Error setting property 'YLabel' of class 'Axes':
Value must be 'matlab.graphics.Graphics'
figure;
ax = gca;
ax.YLabel = "[Pressure [Pa]]" ;
I do not understand the contents of the error message
What is wrong with the value, I try to assign?
I don't get any error message if I just use
ylabel('[Pressure [Pa]]')

채택된 답변

Voss
Voss 2022년 6월 29일
The YLabel is a text object. You mean to set its String property:
figure;
ax = gca;
ax.YLabel.String = "[Pressure [Pa]]" ;
You can see other properties of ax.YLabel you might want to set as well (though not all of them are settable):
disp(properties(ax.YLabel))
{'Color' } {'Position' } {'String' } {'Interpreter' } {'Extent' } {'Rotation' } {'FontName' } {'FontUnits' } {'FontSize' } {'FontAngle' } {'FontWeight' } {'HorizontalAlignment'} {'VerticalAlignment' } {'EdgeColor' } {'LineStyle' } {'LineWidth' } {'BackgroundColor' } {'Margin' } {'Editing' } {'Clipping' } {'FontSmoothing' } {'Interactions' } {'Units' } {'Children' } {'Parent' } {'Visible' } {'HandleVisibility' } {'ButtonDownFcn' } {'ContextMenu' } {'BusyAction' } {'BeingDeleted' } {'Interruptible' } {'CreateFcn' } {'DeleteFcn' } {'Type' } {'Tag' } {'UserData' } {'Selected' } {'SelectionHighlight' } {'HitTest' } {'PickableParts' }
  댓글 수: 6
hans
hans 2022년 6월 29일
Thank You again, supporting my understanding.
Voss
Voss 2022년 6월 29일
You're welcome!

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by