Grootmanager: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
No edit summary
 
Line 10: Line 10:
===Description===
===Description===


Properties are saved in "property sets" in a single structure as a MATLAB preference. The current set is in the .currentset field. Changing the current set will update groot defaults to the new set.  
Properties are saved in "property sets" in a single structure as a MATLAB preference. The current set is in the .currentset field. Changing the current set will update groot defaults to the new set. See documentation from MathWorks on [https://www.mathworks.com/help/matlab/ref/groot.html groot] for more information about graphics root properties.  


When calling 'updateset' for the first time, grootmanager will create a default set name "Groot Set One" and add the current defaults returned by get(groot,'default').
When calling 'updateset' for the first time, grootmanager will create a default set name "Groot Set One" and add the current defaults returned by get(groot,'default').
Line 42: Line 42:


===Examples===
===Examples===


<pre>
<pre>
Line 64: Line 62:
grootmanager('set','factoryAxesTitleHorizontalAlignment','left')
grootmanager('set','factoryAxesTitleHorizontalAlignment','left')
grootmanager('set','factoryFigureColor',[0 0 0])
grootmanager('set','factoryFigureColor',[0 0 0])
A = imread('ngc6543a.jpg');
image(A);
title('Test Image','Color','white')


%Change back to previous set and create plot.
%Change back to previous set and create plot.
grootmanager('changeset','ThickLinesBigFont')
grootmanager('changeset','ThickLinesBigFont')
close all
plot(rand(10))
plot(rand(10))



Latest revision as of 14:48, 16 August 2022

Purpose

Manage and update MATLAB graphics root object properties.

Synopsis

grootmanager(cmd,varargin)
grootmanager(cmd,propName,propValue)

Description

Properties are saved in "property sets" in a single structure as a MATLAB preference. The current set is in the .currentset field. Changing the current set will update groot defaults to the new set. See documentation from MathWorks on groot for more information about graphics root properties.

When calling 'updateset' for the first time, grootmanager will create a default set name "Groot Set One" and add the current defaults returned by get(groot,'default').

NOTE: MATLAB and PLS_Toolbox will add some properties to the default properties. These can be ignored and may or may not end up in a "set" that grootmanager creates. Properties that ofte get set by MATLAB include: defaultFigurePosition, defaultFigurePaperPositionMode, defaultFigureVisible, defaultFigureToolBar, and defaultFigureMenuBar.

Inputs

  • cmd = Command for grootmanager.
    • set - Set property value and add it to the current set.
    • get - Get a property value.
    • updateset - Set current set to get(groot,'default'). If output assigned then property structure is returned.
    • changeset - Change set being used (update all defaults).
    • addset - Add a new property set.
    • removeset - Remove set and reset defaults.
    • getcurrentset - Get current property set struct.
    • getparent - Get main parent structure with all property sets.
    • setparent - Set main parent structure with all property sets.
    • listdefault - List current property defaults that have been set.
    • listfactory - List all properties with default values.
    • listobjects - List ojbects that have properties that can be set.
    • listobject - List properties for given object.
    • search - Look for a term in all properties and return those that include the term.
    • startup - Add current set to current root properties.
    • factoryreset - Remove all default properties.
    • clearall - Remove all current defaults (factoryreset) and remove saved preferences rmpref('GRootManagerProperties').
  • propName = Property name if needed.
  • propValue = Property value if needed.


Examples

%Create first set with current defaults.
mydefaults = grootmanager('updateset')

%Create first set with current defaults.
[currentset, currentsetname] = grootmanager('getcurrentset')

%Create new set for easier viewing.
grootmanager('addset','ThickLinesBigFont')
grootmanager('changeset','ThickLinesBigFont')
grootmanager('set','defaultAxesFontSize',20)
grootmanager('set','defaultLineLineWidth',4)

%Create new set for plotting images.
grootmanager('addset','ImageSetBlackBackground')
grootmanager('changeset','ImageSetBlackBackground')
grootmanager('set','defaultAxesTitleFontSizeMultiplier',3)
grootmanager('set','factoryAxesTitleHorizontalAlignment','left')
grootmanager('set','factoryFigureColor',[0 0 0])

A = imread('ngc6543a.jpg');
image(A);
title('Test Image','Color','white')

%Change back to previous set and create plot.
grootmanager('changeset','ThickLinesBigFont')
close all
plot(rand(10))

%Return structyure of default or factory property name/values.
mylist = grootmanager('listdefault')
mylist = grootmanager('listfactory')

%Return cell array of strings of properties.
mylist = grootmanager('listobjects')
mylist = grootmanager('listobject','line')
mylist = grootmanager('search','axes','color')

See Also

axes, figure, get, groot, grooteditor, reset, set