Synopsis
Modifies the attributes of an existing colorbar.
Syntax
set_colorbar(attributes) set_colorbar(id, attributes)
Description
The function arguments.
Argument | Description |
---|---|
id | A ChipsId structure identifying the item. |
attributes | Configure object properties by giving an attribute string (a space-separated list of key=value pairs), list, dictionary, or a ChIPS object. |
The set_colorbar command sets the specified attributes to the provided values. The modified colorbar becomes current. Multiple colorbars may be modified with a single command by setting the currency to "all".
Customizing the Colorbar
There are several attributes that control the characteristics of colorbars. The set_colorbar command may be used to modify the attribute values of an existing colorbar at any time during a ChIPS session. See "ahelp attributes" and "ahelp setget" for more general information.
If multiple attributes are being set simultaneously and one of them fails, the entire command will fail and the colorbar will not be modified.
Please see the section "Colorbar Preferences and Attributes" below the examples for a list of the colorbar attributes.
Advanced Functions
The module of advanced ChIPS functions contains other commands for setting attribute values (refer to "ahelp chips" for information on loading the module):
set_colorbar_depth set_colorbar_halign set_colorbar_label_angle set_colorbar_label_color set_colorbar_label_font set_colorbar_label_fontstyle set_colorbar_label_halign set_colorbar_label_location set_colorbar_label_size set_colorbar_label_text set_colorbar_label_valign set_colorbar_label_visible set_colorbar_length set_colorbar_orientation set_colorbar_parallel_offset set_colorbar_perpendicular_offset set_colorbar_tick_color set_colorbar_tick_length set_colorbar_tick_location set_colorbar_tick_mode set_colorbar_tick_style set_colorbar_tick_thickness set_colorbar_tick_visible set_colorbar_ticklabel_angle set_colorbar_ticklabel_color set_colorbar_ticklabel_font set_colorbar_ticklabel_fontstyle set_colorbar_ticklabel_halign set_colorbar_ticklabel_offset set_colorbar_ticklabel_size set_colorbar_ticklabel_valign set_colorbar_ticklabel_visible set_colorbar_valign set_colorbar_width
Examples
Example 1
chips> set_colorbar(["width", 0.1, "label.font", "times"])
Using attribute/value pairs, set the colorbar to have a width of one tenth of the plot width, and use the times font for the labels.
Example 2
chips> set_colorbar({"label.text": "log_{10} intensity"})
Here a dictionary is used to change the label text of the colorbar, including LaTeX commands.
Example 3
chips> colbar = ChipsColorBar() chips> colbar.length = 0.5 chips> colbar.tick.color = "red" chips> set_colorbar("cbar1", colbar)
Populate the "colbar" structure with attribute values, then use it to set cbar1 to be half as long as the plot with red tickmarks.
Colorbar Preferences and Attributes
The attributes associated with colorbars are given in the following table, where the "Set?" column refers to whether the attribute can be changed using the set_colorbar() command. To change the colorbar preference settings prepend "colorbar." to the attribute name.
Attribute | Description | Options | Default | Set? |
---|---|---|---|---|
border.visible | should the border of the colorbar be visible? | see the Booleans section of "ahelp chipsopt" | true | Yes |
depth | the depth of the colorbar | see the Depth section of "ahelp chipsopt" | default | Yes |
halign | horizontal alignment of the colorbar | auto|base|center|left|right|top; see the Text Alignment section of "ahelp chipsopt" | center | Yes |
label.angle | angle, in degrees, of the label | -360.0 to 360.0 | 0 | Yes |
label.color | color of the label | name or hex; see the Color section of "ahelp chipsopt" | default | Yes |
label.font | font for the label | helvetica|courier|times|greek; see the Font section of "ahelp chipsopt" | helvetica | Yes |
label.fontstyle | style for the label | normal|bold|italic|bolditalic; see the Font Style section of "ahelp chipsopt" | normal | Yes |
label.halign | horizontal alignment of the label | auto|base|center|left|right|top; see the Text Alignment section of "ahelp chipsopt" | auto | Yes |
label.location | which side of the colorbar does the label appear on, relative to the plot center? | outside|inside | inside | Yes |
label.size | size of the label | 1 to 100 | 12 | Yes |
label.text | text for the colorbar label | Yes | ||
label.valign | vertical alignment of the label | auto|base|center|left|right|top; see the Text Alignment section of "ahelp chipsopt" | auto | Yes |
label.visible | should the label be visible? | see the Booleans section of "ahelp chipsopt" | true | Yes |
length | the length of the colorbar, in plot-normalized coordinates | A real number, greater than 0. | 1 | Yes |
offset.parallel | shift of the label from the center of the colorbar | -0.5 to 0.5 inclusive; 0 is the center and -0.5/+0.5 refer to the edges | 0 | Yes |
offset.perpendicular | shift of the label from the edge of the colorbar (in pixels) | -100 to 100, inclusive | 5 | Yes |
orientation | orientation of the colorbar | "horizontal" or "vertical" | horizontal | Yes |
stem | stem to use for colorbar ids | An alpha-numeric character sequence that does not contain a space | cbar | No |
tick.color | color of the tickmarks | name or hex; see the Color section of "ahelp chipsopt" | default | Yes |
tick.length | length of the tickmarks | Non-negative integer | 4 | Yes |
tick.location | should the ticks and labels appear on the outside or inside of the colorbar with reference to plot center? | inside|outside | outside | Yes |
tick.mode | mode for calculating tickmark locations | arbitrary|count|interval|limits|nice; see the Tick Mode section of "ahelp chipsopt" | nice | Yes |
tick.style | should the tickmarks extend into the colorbar, point out of the colorbar, or both (inside, outside, or centered)? | inside|outside|centered; see the Tick Style section of "ahelp chipsopt" | inside | Yes |
tick.thickness | thickness of the tickmarks | 0.5 to 10.0; see the Thickness section of "ahelp chipsopt" | 1 | Yes |
tick.visible | should the tickmarks be visible? | see the Booleans section of "ahelp chipsopt" | true | Yes |
ticklabel.angle | angle, in degrees, of the tickmark labels | -360.0 to 360.0 | 0 | Yes |
ticklabel.color | color for the numeric tickmark labels | name or hex; see the Color section of "ahelp chipsopt" | default | Yes |
ticklabel.font | font for the tickmark labels | helvetica|courier|times|greek; see the Font section of "ahelp chipsopt" | helvetica | Yes |
ticklabel.fontstyle | style for the tickmark labels | normal|bold|italic|bolditalic; see the Font Style section of "ahelp chipsopt" | normal | Yes |
ticklabel.halign | horizontal alignment of the tickmark labels | auto|base|center|left|right|top; see the Text Alignment section of "ahelp chipsopt" | auto | Yes |
ticklabel.offset | separation, in pixels, of the tickmark labels from the colorbar | Non-negative value | 6 | Yes |
ticklabel.size | font size of the numeric tickmark labels | 1 to 100 | 12 | Yes |
ticklabel.valign | vertical alignment of the tickmark labels | auto|base|center|left|right|top; see the Text Alignment section of "ahelp chipsopt" | auto | Yes |
ticklabel.visible | should the tickmark labels be visible? | see the Booleans section of "ahelp chipsopt" | true | Yes |
valign | vertical alignment of the colorbar | auto|base|center|left|right|top; see the Text Alignment section of "ahelp chipsopt" | center | Yes |
width | the width of the colorbar, in plot-normalized coordinates | Non-negative value | 0.05 | Yes |
Bugs
See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.
See Also
- concepts
- setget
- images
- add_colorbar, current_colorbar, delete_colorbar, display_colorbar, get_colorbar, hide_colorbar, move_colorbar, shuffle_colorbar
- utilities
- set_current