Changing uiaxes title color with button press
3 ビュー (過去 30 日間)
古いコメントを表示
I added a "dark mode" button to my code. Im sure there is a way do this a bit better than I have but I a function with two radial buttons, a light mode and dark mode. When dark mode is clicked the color for everything in the uifigure flips color, typically from white to black or vis versa. I have other buttons that graph stuff, I have a uiaxes figure with a title and for some reason I havent foun a way to change the color. I want to do this in an if loop, below is how I am doing it with the x and y axes. I looked through the uiaxes options extensivly an couldnt find a way to change the color of just the title. Heres how I am doing it for the axes:
if rb1_option == 1
ax.XColor = [0 0 0];
ax.YColor = [0 0 0];
end
if rb2_option == 1
ax.XColor = [1 1 1];
ax.YColor = [1 1 1];
end
This works well for the axes. Any one know of a way to change the title color? Thanks!
0 件のコメント
採用された回答
Voss
2024 年 3 月 31 日
ax.Title.Color = [0 0 1]; % or whatever color you like
2 件のコメント
Voss
2024 年 3 月 31 日
You're welcome!
The important thing to realize is that ax.Title refers to the text object that is the title. So you can set any property of the title by using the syntax "ax.Title.<property> = <value>", e.g.:
ax.Title.Visible = 'off';
ax.Title.EdgeColor = 'b';
ax.Title.LineStyle = '--';
ax.Title.VerticalAlignment = 'top';
ax.Title.Interpreter = 'latex';
% etc.
Here's a list of all text object properties:
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Title についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!