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

77 ビュー (過去 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 Center および File ExchangeLegend についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by