anyway to add text with given location at a 'pixel' based figure
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Yu Li
am 18 Jan. 2019
Kommentiert: Walter Roberson
am 19 Jan. 2019
is there anyway to add text with given location at a 'pixel' based figure?
in the link below: https://www.mathworks.com/help/matlab/creating_plots/add-text-to-specific-points-on-graph.html it requires the position of a given point. but in my situation, I want to add the text at a given place of a pixel based figure.
Bests,
Yu
0 Kommentare
Akzeptierte Antwort
Kevin Phung
am 18 Jan. 2019
Bearbeitet: Kevin Phung
am 18 Jan. 2019
yep!
just do something like:
text1 = uicontrol('Style','text','units','pixels',...
'position',[],'String','Hello')
Just call out the handle text1 and you can see what other properties of the text box you can adjust (color, fontsize,tag, etc..)
5 Kommentare
Kevin Phung
am 19 Jan. 2019
Ahh I see, usually, to center a text with respect to its borders, I add an extra element to the string, so
text1 = uicontrol('Style','text','units','pixels',...
'position',[],'String',{'','Experiment'})
should center the word 'Experiment' in the box. Not the most elegant solution.. but I hope the result is what yo uare looking for.
Weitere Antworten (1)
Walter Roberson
am 19 Jan. 2019
text() permits you to specify horizontal and vertical alignment, and permits you to specify Position and to specify Units . So you can specify the location in Units pixels and you can control how the text aligns relative to that location.
2 Kommentare
Walter Roberson
am 19 Jan. 2019
I would not use uicontrol for this purpose . text() within an axes, annotation() for outside an axes.
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!