Setup Default Property at startup

10 ビュー (過去 30 日間)
Patrick
Patrick 2015 年 6 月 4 日
回答済み: Cindy Solomon 2015 年 6 月 5 日
Dear all,
I regularly change the default values for graphical properties in my startup.m file like
set(0,'DefaultAxesFontName','times');
to set all axes fonts to times.
Recently after updating to R2015a I have an issue when creating pdf/ps file of my figures where the grid lines are hardly visible. I figured out a trick to see them is to set GridAlpha to 1 and GridColor to [0.1 0.1 0.1] as set(gca,'GridLineStyle',':','GridAlpha',1,'GridColor',[0.1 0.1 0.1])
Now I tried to put the following statements in my startup.m file
set(0,'DefaultGridAlpha',1); set(0,'DefaultGridColor',[0.1 0.1 0.1]);
but I get the following error message
Warning: Executing startup failed in matlabrc. This indicates a potentially serious problem in your MATLAB setup, which should be resolved as soon as possible. Error detected was: MATLAB:hgutils:InvalidClassName gridalpha is an invalid class name
My question is how to change the default value of these properties?
Thank you for your help

採用された回答

Cindy Solomon
Cindy Solomon 2015 年 6 月 5 日
Hi Patrick,
To define a default property value, you need to specify a string with the word 'default', the object type (ex: Axes), and the property name (ex: Grid Alpha). For example, in order to set the properties you mentioned, you would do:
set(groot,'DefaultAxesGridAlpha',1);
set(groot,'DefaultAxesGridColor',[0.1 0.1 0.1]);
As of R2014b, MathWorks released a new graphics system wherein graphics handles are now objects instead of doubles. In doing so, you can more easily define properties of a particular level. In addition, the "root object" is now called "groot" (graphics root), although you should still be able to use 0 to set default values. For more information on setting default values, I recommend looking at this page.
Hope this helps!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by