position of axis label

28 ビュー (過去 30 日間)
Ray Lee
Ray Lee 2019 年 12 月 29 日
編集済み: dpb 2019 年 12 月 31 日
When changing the axis limits, the location of the axis label string remains at the center of the axis. But if I moved the label position manually, the label string location is binded to a value. When changing the axis limits, the label string moves away from the axis center.
I checked the properties of the label:
>> ax.XLabel.get
BackgroundColor: 'none'
BeingDeleted: 'off'
BusyAction: 'queue'
ButtonDownFcn: ''
Children: [0×0 GraphicsPlaceholder]
Clipping: 'off'
Color: [1 1 0.8000]
CreateFcn: ''
DeleteFcn: ''
EdgeColor: 'none'
Editing: 'off'
Extent: [216.0002 -79.8522 0 0]
FontAngle: 'normal'
FontName: 'Helvetica'
FontSize: 8.2500
FontSmoothing: 'on'
FontUnits: 'points'
FontWeight: 'bold'
HandleVisibility: 'off'
HitTest: 'on'
HorizontalAlignment: 'center'
Interpreter: 'tex'
Interruptible: 'on'
LineStyle: '-'
LineWidth: 0.5000
Margin: 3
Parent: [1×1 Axes]
PickableParts: 'visible'
Position: [216.0002 -79.8522 1]
Rotation: 0
Selected: 'off'
SelectionHighlight: 'on'
String: ''
Tag: ''
Type: 'text'
UIContextMenu: [0×0 GraphicsPlaceholder]
Units: 'data'
UserData: []
VerticalAlignment: 'top'
Visible: 'on'
There is no property to set to make the positioning automatic.
How can I recover the automatic positioning?

採用された回答

dpb
dpb 2019 年 12 月 29 日
編集済み: dpb 2019 年 12 月 31 日
"There is no property to set to make the positioning automatic."
Ah, but there is...unfortunately, it's another of those frustrating things TMW hid from the user...but, thanks to being able to find out about such via <Yair's undocumented handles function>,
hAx.XLabel.PositionMode='auto';
will do the trick. When you position the label the value gets set to ' manual' which turns off the automagic recomputation of the center position. Fortunately, the other property values remain unchanged so don't have to do more than just toggle the mode indicator.
It's surely unfortunate TMW chose to hide so many of these really useful and needed properties and have no indication in the documentation there are such things available. :(

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by