GUI - position axis label possible?

2 ビュー (過去 30 日間)
Jan w
Jan w 2017 年 4 月 9 日
編集済み: jean-luc 2023 年 8 月 16 日
Good day everyone,
I'm having little place on my gui to make the axis label visible. I could of cause resize the plot but I really don't want to, everything is well structured. So is there a way i can position the x label? My idea was to delete the zero of the xlim and then position down the label. I don't know how promising this idea is. Do you know of some better options? I considered adding a *.svg with the axis symbol but that is stupid i guess.
Thanks for your help. Regards

回答 (1 件)

dpb 2017 年 4 月 9 日
編集済み: dpb 2017 年 4 月 12 日
Not certain what you want labelled where but xlabel by default will be at the midpoint of the axes to which it belongs and below the associated tick labels if shown or at the edge of the axis line if ticks aren't present.
But, it's just a text object; save the handle created and then you can modify the 'Position' property as desired.
To write text to arbitrary location(s ), use...wait a minute, drum roll, please!... text!!! :)
May want to use a fixed dimension for the 'position' property rather than the default 'Data' units so the position can be located relative to the actual figure rather than being scaled by the data values if they change...
But, if you know where the position is supposed to be initially, you can still use xlabel if want with the 'Position' vector as
xlabel('This is X','Position',[xpos ypos zpos])
but at that point may as well just revert to text form the beginning it would's the same animal underneath just which syntax is more useful is your call I think. Altho note that the 'Position' property is a three-vector where z=0 for a 2D plot; it still must be given. OTOH, the text interface just uses the x-, y- coordinates. Just a minor detail but can't overlook.
While it's been long time now with no response must presume got this worked out or gave up one, I'll note one way to work out this kind of thing would be to draw the gui and add the proposed xlabel text with default position and then use the edit tools to move it to desired position. Then you can query what that position vector is and use that to automagically create the figure in the code. "Cheating" is ok in such circumstances... :)
  1 件のコメント
jean-luc 2023 年 8 月 16 日
編集済み: jean-luc 2023 年 8 月 16 日
Bonjour DB,
xlabel('This is X','Position',[xpos ypos zpos])
xlabel("t", "position",[0 0 0]); // CA MARCHE !!!
Bien cordialement



Help Center および File ExchangeAxis Labels についてさらに検索


Community Treasure Hunt

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

Start Hunting!

Translated by