How do I change the default axis color and axis label text to black?
29 次查看(过去 30 天)
显示 更早的评论
I want to set the default so that all figures generated henceforth will have black axes and black axis labels. As of now, MATLAB default outputs this really godawful, ugly grey color intead of black and I am really really frickin sick of having to correct this in Illustrator every time. I don't want to have to manually set these values to black every single time I write code for a figure, so how do I change the default?
Extensive googling on this issue has returned nothing useful on this front. Any help is appreciated.
1 个评论
Nicholas Tarasenko
2017-3-28
编辑:Nicholas Tarasenko
2017-3-28
Adam, try including this line everytime you create a figure: set(gca,'Color','b') I know it's a bit clunky to have to include this text every time you plot something. It probably beats doing it manually "in illustrator every time". Also, I use this nugget: set(gcf,'color','w') to control my background color, I also found you can default this with the following command: set(0, 'DefaultFigureColor', 'white');
回答(1 个)
dpb
2017-3-26
编辑:dpb
2017-3-28
set(groot,{'DefaultAxesXColor','DefaultAxesYColor','DefaultAxesZColor'},{'k','k','k'})
uses slightly the cell array form and fixes my previous error of deleting the 'Factory' had pasted then failed to change to 'Default'--had thought was doing it w/ a replace text operation but didn't work and didn't proof work...
6 个评论
Steven Lord
2017-3-28
From the "Specify Default Values" section of the page to which dpb linked:
Define a default property value using a character vector with these three parts:
'default' ObjectType PropertyName
So from Jan's example set(groot, 'defaultAxesXColor', ... whenever you create an object of type axes that has the groot object as an ancestor after setting that property on groot, its that axes will have the value you specified for its XColor property. Since groot is an ancestor of all graphics objects, this will affect all new axes.
If instead you had run set(gcf, 'defaultAxesXColor', ... only new axes added to the figure that was gcf at that time would be affected; new axes added to other figures would not.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Properties 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!