Setup Default Property at startup
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Patrick
le 4 Juin 2015
Réponse apportée : Cindy Solomon
le 5 Juin 2015
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
0 commentaires
Réponse acceptée
Cindy Solomon
le 5 Juin 2015
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!