Difference between revisions of "Graph Style Templates"

 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[What's new in Analytica 4.0?]] >
+
[[Category: Graphs]]
  
You can store graph style settings in a <em>Graph Style Template</em>, and then use the template in specific graphs without having to individually select and define color, font and style combinations. Because the template is an Analytica object, you can maintain several graph style templates within a single model, and even create libraries of graph style templates.
+
A <em>Graph Style Template</em> is a collection of graph settings that you can apply to any graph. The settings may include chart type, axis range, style, colors, fonts, and background. Analytica comes with some standard graph templates. You can also create your own graph templates to define consistent styles for a model, a project, or even for your entire organization.
  
= Selecting a Pre-Existing Graph Style Template=
+
__TOC__
  
To select a pre-existing style template for a graph, bring up the Graph Setup dialog and select the template name in the "Style Template" pulldown at the top of the window.
+
=== To use a Graph Style Template ===
  
When you select a template in the pulldown, the settings for that template are immediately reflected in the graph setup controls.  The "Set Default" button changes to read "Set Template".
+
To apply an existing graph template to a graph:
 +
# Double click your graph to open the '''Graph Setup''' dialog.
 +
# From the '''Style template''' menu at the bottom of the dialog, select the template you want.
 +
# To see what the templates look like, click the '''Preview''' tab. When you select an option from the '''Style template''' menu, it applies it to the selected graph. All template settings will be reflected in the settings in the other tabs.
 +
# If you want to modify any other settings beyond those in the template, you can do so now.
 +
# When you are happy with the the results (check them in the '''Preview''' tab), click "Apply" -- or if you don't like any of them, click "Cancel".
  
You can then modify individual style settings if the template style is not perfect.
+
=== To stop using a Graph Style Template  ===
  
== Apply Button ==
+
If you have a graph that uses a template '''T''', and you wish to unlink it from the template, change the "Style Template" menu back from '''T''' to "Global Default".  It asks "[[Disassociating a Graph Template|Would you like to keep the styles from the template with this graph?]]"  If you answer yes, it will copy the template settings to be local for this variable, so it looks the same, but future changes to the template will have no effect. If you answer no, it will remove the template settings from this graph so it reverts to the global defaults.
  
Pressing Apply saves any modifications you have made since the template was selected in the current variable's graph setup.  Settings that were not modified are only in the template, so if the template settings change, so will your graph's appearance.
+
=== To define a new Graph Style Template ===
  
= Defining a New Graph Style Template =
+
To create a new Graph Template so you can reuse a collection of graph settings for other variables:
 +
# Open the '''Graph Setup''' dialog by double-clicking on the graph with the settings you want to reuse -- or  if you want to save only new settings, open it for a new variable.
 +
# If you want to modify or add any settings, make those changes. You can also make a new template with changes to an existing template: In that case, select the existing template and click '''Apply template'''.
 +
# Click the Preview tab to see what all settings will look like.
 +
# From the "Style Template" menu, select "New Template". 
 +
# Type in a name for the template. 
 +
# Click the "Set Template" button.
  
From the Graph Setup dialog, select the "New Template" option from the "Style Template" pulldown.  Enter a name.  When you press the "Set Template" button, a new template object is created.  This object is initially a child of your top-level model or module, but has no visual depiction on the diagram view. It can be seen in the outliner view.
+
You have now created a new template, which will saved it with the model. You may apply it to any graph in the model.  
  
Any settings you have defined for this graph, or since the template was created, are then saved into the new style template.
+
=== To modify a Graph Style Template ===
 +
To modify an existing Graph Style Template T:
 +
# Open the "Graph setup dialog by double clicking on a graph for variable V.
 +
# If variable V does not already use template T, select T from the Style template menu.
 +
# Modify any '''Graph settings''' you want for T.
 +
# Check the effect in the '''Preview''' tab.
 +
# When satisfied, click '''Set template'''.
  
The newly created template begins with any settings that have already been specified.  So, for example, if you had selected a pre-existing template, modified some settings, and then created a "New Template", the new template will have the settings of the original template plus the modifications.  If you continue to modify it before you press "Set Template", those settings will also be part of the new template.
+
'''Note:''' Any changes you make to a template will affect all variables that use it -- except for any local settings that override them for a particular variable.
  
The new template doesn't actually exist until you press the "Set Template" button.  So, if you press Apply or Cancel to leave the dialog, the template will not be created.  To correct this mistake, re-open graph settings on the same graph (which now has the settings you wish to comprise the template), select "New Template" again and enter a name, and press the "Set Template" button.
+
=== Combining global, template, and individual graph style settings ===
 +
You can set graph style (and most uncertainty settings) at three levels:
  
= Renaming a Style Template =
+
'''Global:''' By clicking '''Set Default''' in the Graph setup or Uncertainty Setup dialog, you change the global defaults for the model.
  
With a style template selected in the graph setup, click in the combo box area to enter edit mode.  Type the new name. The text here is actually the title attribute for the style, the underlying identifier is not renamed.
+
'''Template:''' By selecting a Style template in Graph setup, and clicking Apply, you apply the template settings to the current variable. They override any Global settings.
  
= Modifying a Style =
+
'''Local:''' By clicking '''Apply''' in the Graph setup or Uncertainty Setup dialog, you change the settings just for the current variable. These override any global or template settings.
  
Bring up a graph, select the style, and adjust the graph's appearance to your liking.  Press "Set Template".  All style settings that had ever been changed, either by the template, or while adjusting the graph, will become part of the template.  (Those that have never been touched will remain inherited from the global default).
+
Note that a template does not save global settings: If you change a global setting by clicking ''Set default''', that change will affect all graphs that do not override them by a template or a local setting.
  
If you want to control exactly which styles are set in the template, create a new variable (which therefore has no pre-existing style settings), graph something (e.g., Time^2) and then bring up the graph setup dialog, select the style, make only those changes you want in the Template and press "Set Template".  You can delete the variable afterwards, the template will remain.
+
=== Graph templates and setting associations ===
 +
'''Chart type settings:''' Graph settings from the '''Chart type''' tab are associated with a particular uncertainty view. For example, if you set '''Linestyle''' to symbols only for a Sample plot, that line style will apply to any [[Sample]] plot, but not for [[Mid]], [[Mean]], [[Statistics]], [[PDF]], or [[CDF]]. Thus, you may set a different Style settings for each uncertainty view -- except Mid, Mean, and Statistics, which share the same Style.
  
If you re-select "New Template" before pressing "Set Template", you will create a new template that consists of the settings found in the old template, modified by settings made for the current variable or modified since the dialog has been open.
+
'''Axes:''' If the horizontal axis is an index (the usual case), any settings on the '''Axes Ranges''' tab, apply to that index only. For example, suppose variable <code>Earthquake_damage</code> is indexed on the horizontal axis by <code>Richter_scale</code>. You set <code>Richter_scale</code> to Log scale, and save into a template T. If you use template T for another variable Y also indexed by <code>Richter_scale</code>, it will also display <code>Richter_scale</code> on a log scale. But, if Y is not indexed by <code>Richter_scale</code>, this Axis setting will have no effect.
  
= Moving a Style Template =
+
'''Uncertainty options and graph templates:''' A Graph template will also save non-default settings made in the '''Uncertainty setup''' dialog tabs -- '''Statistics''', '''Confidence bands''', '''Probability density''', or '''Cumulative probability'''.  These settings apply to the corresponding uncertainty view of any variable using the template.  Changes to the Uncertainty '''sample''' tab -- e.g. to Sample size -- are global, and affect the entire model: They are not associated with particular variable, or saved in a graph template.
  
If you want to move the style template object, for example, if you'd like to locate it in a particular linked module, this must be done using the Typescript [[Move|Move command]].
+
For more see [[Graph Setting Associations]]
  
= Deleting a Style Template =
+
=== Changing the Global Default ===
 +
"Global Default" specifies the default settings used by every graph unless overridden in the '''Graph setup''' dialog for that graph or by a template that it uses. If the '''Style Template''' menu says '''Global default''', it means that the graph uses the global defaults with no template. 
  
Deleting a style template can only be done in the outliner window or typescript. If any graphs use the template, the link to the template will be removed and those graphs will lose the settings from the template.
+
To modify the global defaults:
 +
# Select a new variable with no graph settings, or a graph whose settings you want to make the global default.
 +
# Double click on the graph to open '''Graph setup''' dialog.
 +
# If you want, make further changes to the settings, and review them in the '''Preview''' tab.
 +
# From the '''Style template''' menu, select '''Global Default'', if it isn't already selected.
 +
# Click '''Set default''' button.
  
= Global Default =
+
'''Note:''' Changes to global defaults will change all existing and new graphs that use global defaults -- unless they are overridden by Graph settings or a template set for that graph .
  
The "Global Default" option displays initially in the "Style Template" pulldown.  This indicates that no style template is used, so any settings not explicitly set are inherited from the global defaults (system variables, associated index, etc). The "Set Default" button can be used to change the global defaults used by all non-template graphs.
+
=== To rename a Graph style template ===
 +
# Open the Graph setup dialog, by double-click on a graph.
 +
# In the '''Style template''' menu, select the Graph template you want to rename.
 +
# Click the '''Style template'''menu to select the old name.
 +
# Type in the new name.
 +
# Click '''Set template'''.
  
= To Stop using a template =
+
Note: The template "name" is actually its Title attribute -- not its identifier. So, renaming a template does not affect any variables that use it.
  
If you have a graph that uses a template, and you wish to unlink it from the template, change the "Style Template" pulldown back to "Global Default"A question is asked: "Do you want to transfer the settings from Template XXX to this variable's graph setup?".  Answering no will dump all settings that come from the template.  Answering Yes will leave these settings in place.
+
=== To save Graph Style Templates into a Library module ===
 +
Advanced users may save one or more Graph style Templates into a library module, so that you can reuse them in other models.  Graph style templates are usually saved inside your model at the top level. They do ''not'' appear in Diagrams, but you can see them in the Outline view. Here is how you can move templates into a library module:
  
= Associations =
+
# Create a library module called, say, <code>Template_library</code>.
 +
# Open the [[Outline window]] by clicking on its icon in the tool bar.
 +
# Find the template in the Outline window, and double click to open its [[Object Window]].
 +
# Copy its identifier <id> by double-clicking the identifier in the Object window, and pressing ''Ctrl+C''.
 +
# Open the [[Typescript]] window by pressing ''Ctrl+' ''.
 +
# Type <code>Move <id> Template_library</code>
 +
#:where <code><id></code> is the identifier you paste with ''Ctrl+V''. [[Move|Move command]]
  
Graph settings having an index [[Graph_Setting_Associations|association]] will apply only to the specific index, even when stored in a template. For example, suppose you set up a graph having Richter_Magnitude on the X-axis, and you set this X-axis to be log-scaled.  Next, suppose you store this setting in a template.  When you use this template for another graph, you will not necessarily get a log-scaled X-axis -- the log-scaling will apply IF the X-axis is Richter_Magnitude. Since this setting was stored in a template, rather than in the Global Default, graphs not using this template will not log-scale Richter_magnitude.
+
Repeat for any other templates you want to include. When complete, you can save the <code>Template_library</code> as a separate library file in the usual way:
 +
# Double-click the <code>Template_library</code> to open its [[Object Window]] (in Edit mode)
 +
# Press the '''Class''' menu at top-left of the Object window to open it, and change selection to '''Filed library'''.
 +
# Answer the prompts for the new file name and folder location, and click '''Save'''.
  
Index-range settings (auto-scale, manual settings, log-scaling, reverse order, categorical, include zero) apply only to the specific index, even if stored in a template.
+
=== To delete a Style Template ===
 +
Advanced users can delete a template, following the approach above to find its identifier <code><id></code>. Then
 +
# Press ''Ctrl+' '' to open the [[Typescript]] window
 +
# Type  <code>Delete <id></code> into the typescript, where <code><id></code> is the identifier of the template.
  
Line style settings also have the same associations as usual, even if stored in a template.  Therefore, if you set the line style for a discrete prob mass plot, this line style will apply to discrete line style plots. A single template may contain different line styles for each of the graph view clusters.
+
When you delete a template, it removes links from any graphs to that template. Any settings on graphs that used the template revert to the Global defaults.
 +
 
 +
==History==
 +
Introduced in [[What's new in Analytica 4.0?|Analytica 4.0]].
 +
 
 +
==See Also==
 +
* [[Disassociating a Graph Template]]
 +
* [[Graph Setting Associations]]
 +
* [[Customization of Graph Colors]]
 +
* [[Move]]
 +
* [[Delete]]
 +
* [[Typescript]]

Latest revision as of 18:25, 6 January 2023


A Graph Style Template is a collection of graph settings that you can apply to any graph. The settings may include chart type, axis range, style, colors, fonts, and background. Analytica comes with some standard graph templates. You can also create your own graph templates to define consistent styles for a model, a project, or even for your entire organization.

To use a Graph Style Template

To apply an existing graph template to a graph:

  1. Double click your graph to open the Graph Setup dialog.
  2. From the Style template menu at the bottom of the dialog, select the template you want.
  3. To see what the templates look like, click the Preview tab. When you select an option from the Style template menu, it applies it to the selected graph. All template settings will be reflected in the settings in the other tabs.
  4. If you want to modify any other settings beyond those in the template, you can do so now.
  5. When you are happy with the the results (check them in the Preview tab), click "Apply" -- or if you don't like any of them, click "Cancel".

To stop using a Graph Style Template

If you have a graph that uses a template T, and you wish to unlink it from the template, change the "Style Template" menu back from T to "Global Default". It asks "Would you like to keep the styles from the template with this graph?" If you answer yes, it will copy the template settings to be local for this variable, so it looks the same, but future changes to the template will have no effect. If you answer no, it will remove the template settings from this graph so it reverts to the global defaults.

To define a new Graph Style Template

To create a new Graph Template so you can reuse a collection of graph settings for other variables:

  1. Open the Graph Setup dialog by double-clicking on the graph with the settings you want to reuse -- or if you want to save only new settings, open it for a new variable.
  2. If you want to modify or add any settings, make those changes. You can also make a new template with changes to an existing template: In that case, select the existing template and click Apply template.
  3. Click the Preview tab to see what all settings will look like.
  4. From the "Style Template" menu, select "New Template".
  5. Type in a name for the template.
  6. Click the "Set Template" button.

You have now created a new template, which will saved it with the model. You may apply it to any graph in the model.

To modify a Graph Style Template

To modify an existing Graph Style Template T:

  1. Open the "Graph setup dialog by double clicking on a graph for variable V.
  2. If variable V does not already use template T, select T from the Style template menu.
  3. Modify any Graph settings you want for T.
  4. Check the effect in the Preview tab.
  5. When satisfied, click Set template.

Note: Any changes you make to a template will affect all variables that use it -- except for any local settings that override them for a particular variable.

Combining global, template, and individual graph style settings

You can set graph style (and most uncertainty settings) at three levels:

Global: By clicking Set Default in the Graph setup or Uncertainty Setup dialog, you change the global defaults for the model.

Template: By selecting a Style template in Graph setup, and clicking Apply, you apply the template settings to the current variable. They override any Global settings.

Local: By clicking Apply in the Graph setup or Uncertainty Setup dialog, you change the settings just for the current variable. These override any global or template settings.

Note that a template does not save global settings: If you change a global setting by clicking Set default', that change will affect all graphs that do not override them by a template or a local setting.

Graph templates and setting associations

Chart type settings: Graph settings from the Chart type tab are associated with a particular uncertainty view. For example, if you set Linestyle to symbols only for a Sample plot, that line style will apply to any Sample plot, but not for Mid, Mean, Statistics, PDF, or CDF. Thus, you may set a different Style settings for each uncertainty view -- except Mid, Mean, and Statistics, which share the same Style.

Axes: If the horizontal axis is an index (the usual case), any settings on the Axes Ranges tab, apply to that index only. For example, suppose variable Earthquake_damage is indexed on the horizontal axis by Richter_scale. You set Richter_scale to Log scale, and save into a template T. If you use template T for another variable Y also indexed by Richter_scale, it will also display Richter_scale on a log scale. But, if Y is not indexed by Richter_scale, this Axis setting will have no effect.

Uncertainty options and graph templates: A Graph template will also save non-default settings made in the Uncertainty setup dialog tabs -- Statistics, Confidence bands, Probability density, or Cumulative probability. These settings apply to the corresponding uncertainty view of any variable using the template. Changes to the Uncertainty sample tab -- e.g. to Sample size -- are global, and affect the entire model: They are not associated with particular variable, or saved in a graph template.

For more see Graph Setting Associations

Changing the Global Default

"Global Default" specifies the default settings used by every graph unless overridden in the Graph setup dialog for that graph or by a template that it uses. If the Style Template menu says Global default, it means that the graph uses the global defaults with no template.

To modify the global defaults:

  1. Select a new variable with no graph settings, or a graph whose settings you want to make the global default.
  2. Double click on the graph to open Graph setup dialog.
  3. If you want, make further changes to the settings, and review them in the Preview tab.
  4. From the Style template' menu, select Global Default, if it isn't already selected.
  5. Click Set default button.

Note: Changes to global defaults will change all existing and new graphs that use global defaults -- unless they are overridden by Graph settings or a template set for that graph .

To rename a Graph style template

  1. Open the Graph setup dialog, by double-click on a graph.
  2. In the Style template menu, select the Graph template you want to rename.
  3. Click the Style templatemenu to select the old name.
  4. Type in the new name.
  5. Click Set template.

Note: The template "name" is actually its Title attribute -- not its identifier. So, renaming a template does not affect any variables that use it.

To save Graph Style Templates into a Library module

Advanced users may save one or more Graph style Templates into a library module, so that you can reuse them in other models. Graph style templates are usually saved inside your model at the top level. They do not appear in Diagrams, but you can see them in the Outline view. Here is how you can move templates into a library module:

  1. Create a library module called, say, Template_library.
  2. Open the Outline window by clicking on its icon in the tool bar.
  3. Find the template in the Outline window, and double click to open its Object Window.
  4. Copy its identifier <id> by double-clicking the identifier in the Object window, and pressing Ctrl+C.
  5. Open the Typescript window by pressing Ctrl+' .
  6. Type Move <id> Template_library
    where <id> is the identifier you paste with Ctrl+V. Move command

Repeat for any other templates you want to include. When complete, you can save the Template_library as a separate library file in the usual way:

  1. Double-click the Template_library to open its Object Window (in Edit mode)
  2. Press the Class menu at top-left of the Object window to open it, and change selection to Filed library.
  3. Answer the prompts for the new file name and folder location, and click Save.

To delete a Style Template

Advanced users can delete a template, following the approach above to find its identifier <id>. Then

  1. Press Ctrl+' to open the Typescript window
  2. Type Delete <id> into the typescript, where <id> is the identifier of the template.

When you delete a template, it removes links from any graphs to that template. Any settings on graphs that used the template revert to the Global defaults.

History

Introduced in Analytica 4.0.

See Also

Comments


You are not allowed to post comments.