How do I change color of a text in a given subplot?
427 views (last 30 days)
Show older comments
Commented: Image Analyst on 7 Dec 2013
I have a given figure which contains 2 subplots. the first subplot has a text on it. I want to change the text color and size using set/get parent/children commands... I already have the handle to the line in the top subplot(which is the first subplot as well). how can I do that? Is 'text' a parent or a child off the line in the top figure?
sixwwwwww on 7 Dec 2013
Edited: sixwwwwww on 7 Dec 2013
you can change text color as follow:
x = -pi:.1:pi;
y = sin(x);
text(-pi/4, sin(-pi/4), '\leftarrow sin(-\pi\div4)', 'HorizontalAlignment','left', 'Color', 'r')
Or if you wanted to use set command then you can do it as follow:
h = text(-pi/4, sin(-pi/4), '\leftarrow sin(-\pi\div4)', 'HorizontalAlignment','left');
set(h, 'Color',[1, 0 ,0])
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!