Synopsis
Sets the specified preferences.
Syntax
set_preferences(list) set_preferences(dictionary) set_preferences(string) set_preferences(object)
Description
The function arguments.
Argument | Description |
---|---|
list or dictionary | A list of key/value pairs or a dictionary, for example: ["curve.symbol.color", "red", "export.clobber", True] or {"curve.symbol.color": "red", "export.clobber": True}. Unlike set_preference, the values need not be strings. |
string | A string containing a single preference/value entry, such as "point.fill=false". The preference name can include '*' when it makes sense, such as 'curve.*.color'. |
object | An attribute object - such as ChipsHistogram or ChipsPReferences - containing the fields to be changed. Any field with a value of None is ignored. |
When do the changes take affect?
The set_preferences command sets the specified set of preferences to the supplied value. The new settings do not affect the attributes of existing objects and data, only new ones created after the call to set_preferences, except for the foreground.display and background.display settings. For these two preferences only, all existing windows will also be updated.
What objects can be used?
The following attribute objects are supported:
- ChipsWindow
- ChipsFrame
- ChipsPlot
- ChipsAxis
- ChipsCurve
- ChipsHistogram
- ChipsImage
- ChipsContour
- ChipsLabel
- ChipsLine
- ChipsPoint
- ChipsRegion
- ChipsColorBar
- ChipsExport
- ChipsInfo
- ChipsPreferences
The ChipsPreferences object contains fields for all the objects and for the ancillary preferences such as "export" and "info".
The meanings of the various fields of these objects are given in "ahelp preferences" and "ahelp set_<object>" (e.g. "ahelp set_image"). The ChIPS Dictionary ("ahelp chipsopt") lists the allowed values for colors, fonts, line styles, etc.
Saving and restoring preferences
The save_preferences and load_preferences commands may be used to save and reload ChIPS preferences, respectively.
Examples
Example 1
chips> set_preferences(["point.color", "red", "point.size", 3])
Set the default point color to red and the size to 3.
Example 2
chips> prefs = ['foreground.display', 'black', 'background.display', 'white']) chips> set_preferences(prefs)
Change the colors used to display the 'default' color values for the display (i.e. on screen) to match that used when creating the hardcopy (e.g. PNG, PDF) versions of the visualization (i.e. the foreground.file and background.file settings).
Unlike other preferences, these two are applied to all existing windows as well as any new ones created after the set_preferences call.
Example 3
chips> prefs = {'foreground.display': 'black', 'background.display': 'white'} chips> set_preferences(prefs)
This is a repeat of the previous example, using a dictionary rather than a list to define the preferences to change.
Example 4
chips> set_preferences("point.fill=false")
By default, points will not be filled.
Example 5
chips> set_preferences("axis.*.thickness=2")
Change all the thickness elements of the axis to use a thickness of 2 by default.
Example 6
chips> axp = ChipsAxis() chips> axp.label.color = "red" chips> axp.offset.perpendicular = 10 chips> set_preferences(axp)
Using the axp object, set the default axis label color to red and the perpendicular offset to 10.
Bugs
See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.
See Also
- concepts
- preferences, setget
- preference
- get_preference, get_preferences, load_preferences, save_preferences, set_preference, set_preference_autoload
- utilities
- set_current