GUI - position axis label possible?

2 visualizzazioni (ultimi 30 giorni)
Jan w
Jan w il 9 Apr 2017
Modificato: jean-luc il 16 Ago 2023
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

Risposte (1)

dpb
dpb il 9 Apr 2017
Modificato: dpb il 12 Apr 2017
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 seem...it'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.
ADDENDUM
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 Commento
jean-luc
jean-luc il 16 Ago 2023
Modificato: jean-luc il 16 Ago 2023
Bonjour DB,
MERCI BEAUCOUP
xlabel('This is X','Position',[xpos ypos zpos])
xlabel("t", "position",[0 0 0]); // CA MARCHE !!!
Bien cordialement
Jean-luc

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by