MATLAB Answers

position of axis label

78 views (last 30 days)
Ray Lee
Ray Lee on 29 Dec 2019
Edited: dpb on 31 Dec 2019
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?

Accepted Answer

dpb on 29 Dec 2019
Edited: dpb on 31 Dec 2019
"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>,
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. :(

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by