Synopsis
Retrieves the attribute value(s) of the axis.
Syntax
get_axis() get_axis(id) get_axis(id, attribute) The properties of individual axes may also be retrieved using the get_xaxis() and get_yaxis() routines.
Description
The function arguments.
Argument | Description |
---|---|
id | A ChipsId structure identifying the item, or a string containing the name of the object. |
attribute | The name of the attribute to retrieve, such as 'label.color' or 'pad'. |
The get_axis command returns a structure containing all the attribute values of the axis. To retrieve the value of a specific attribute, provide the attribute name and the id or ChipsId of the object.
Some values are set to "None" in the returned structure. These entries generally correspond to attributes which may only be modified at creation time, such as the object id.
Please see the "Axis Preferences and Attributes" section below the examples for a list of the axis attributes.
Axis Range
The get_axis_range, get_plot_xrange, and get_plot_yrange command returns the range of the specified axis of the current plot. The values are returned as [min, max]. The get_plot_range returns the range of both the current X and Y axes.
Axis labels
The x.label.angle, x.label.text, y.label.angle, and y.label.text fields allow you to both retrieve the label text by saying
xlbl = get_xaxis("ax1", "x.label.text") ylbl = get_yaxis("ay1", "y.label.text")
or to change it with calls like
set_yaxis(['y.label.text', 'Flux (erg/cm^s/s)'])
Note that the "x." or "y." suffix must be used, even when using the get_xaxis/yaxis or set_xaxis/yaxis routines. The set_plot_xlabel(), set_plot_ylabel(), and get_axis_text() routines can also be used to change the label text.
Is the axis visible?
To see if an axis is hidden or visible, use the get_axis_visible command.
Advanced Functions
The module of advanced ChIPS functions contains other commands for retrieving attribute values (refer to "ahelp chips" for information on loading the module):
get_axis_automax get_axis_automin get_axis_color get_axis_depth get_axis_label_angle get_axis_label_color get_axis_label_font get_axis_label_fontstyle get_axis_label_halign get_axis_label_size get_axis_label_valign get_axis_label_visible get_axis_major_color get_axis_major_interval get_axis_major_length get_axis_major_mode get_axis_major_num get_axis_major_style get_axis_major_thickness get_axis_majorgrid_color get_axis_majorgrid_style get_axis_majorgrid_thickness get_axis_majorgrid_visible get_axis_minor_color get_axis_minor_interval get_axis_minor_length get_axis_minor_mode get_axis_minor_num get_axis_minor_style get_axis_minor_thickness get_axis_minorgrid_color get_axis_minorgrid_style get_axis_minorgrid_thickness get_axis_minorgrid_visible get_axis_pad get_axis_parallel_offset get_axis_perpendicular_offset get_axis_scale get_axis_thickness get_axis_tickformat get_axis_ticklabel_angle get_axis_ticklabel_color get_axis_ticklabel_font get_axis_ticklabel_fontstyle get_axis_ticklabel_halign get_axis_ticklabel_offset get_axis_ticklabel_size get_axis_ticklabel_style get_axis_ticklabel_valign get_axis_ticklabel_visible get_axis_tickstyle get_axis_transform get_major_ticks_visible get_minor_ticks_visible
Examples
Example 1
chips> make_figure("img.fits", "image") chips> ylbl = get_yaxis().y.label.text chips> set_yaxis(['y.label.text', ylbl.lower()]
Here the get_yaxis call is used to find out the text used for the Y axis by the make_figure command. This is then converted to lower case (using Python's lower method for strings), and set as the new Y axis label using set_yaxis; this could also have been done by saying
chips> set_plot_ylabel(ylbl.lower())
Example 2
chips> add_axis(X_AXIS, 20, 0, 100, "color=yellow") chips> print(get_axis()) chips> print(get_axis("ax1","color"))
An axis is created and becomes current. Calling get_axis with no argument returns all the attributes of the object. get_axis is called a second time to return just the "color" attribute.
Example 3
chips> add_axis(X_AXIS, 20, 0, 100, "color=yellow") chips> add_axis(XY_AXIS, 40, 0, 100,"color=magenta") chips> print(get_axis("ax1"))
Two axes are created. get_axis is called with the id of the first x-axis, returning all attributes.
Example 4
chips> id=ChipsId() chips> id.axis="ax1" chips> print(get_axis(id))
A ChipsId structure is created and the id.axis field is set to "ax1". get_axis is called with the ChipsId.
Example 5
chips> axisatt = get_axis() chips> print(axisatt)
Retrieve a structure containing the attribute values of the current axis and store the results in "axisatt". Print the contents of "axisatt".
Axis Preferences and Attributes
The attributes associated with axes are given in the following table, where the "Set?" column refers to whether the attribute can be changed using the set_axis() command. To change the axis preference settings prepend "axis." to the attribute name.
Attribute | Description | Options | Default | Set? |
---|---|---|---|---|
automin | Should the axis automatically reset its minimum when a curve, histogram, image, or contour is added? | see the Booleans section of "ahelp chipsopt" | true | Yes |
automax | Should the axis automatically reset its maximum when a curve, histogram, image, or contour is added? | see the Booleans section of "ahelp chipsopt" | true | Yes |
color | Color of the axis base line segment | name or hex; see the Color section of "ahelp chipsopt" | default | Yes |
coordsys | coordinate system for the axis | PIXEL, WINDOW_NORM, FRAME_NORM, PLOT_NORM, DATA | see "ahelp coordsys" | No |
depth | Integer value indicating axis depth | see the Depth section of "ahelp chipsopt" | default | Yes |
label.color | Color of the axis label | name or hex; see the Color section of "ahelp chipsopt" | default | Yes |
label.font | font for the axis label text | helvetica|courier|times|greek; see the Font section of "ahelp chipsopt" | helvetica | Yes |
label.fontstyle | style of the axis label text | normal|bold|italic|bolditalic; see the Font Style section of "ahelp chipsopt" | normal | Yes |
label.halign | Horizontal location of the string reference point of the axis label | auto|base|center|left|right|top; see the Text Alignment section of "ahelp chipsopt" | center | Yes |
label.size | Font size of the axis label | 1 to 100 | 14 | Yes |
label.valign | Vertical location of the string reference point of the axis label | auto|base|center|left|right|top; see the Text Alignment section of "ahelp chipsopt" | center | Yes |
majorgrid.color | Color of the axis major grids | name or hex; see the Color section of "ahelp chipsopt" | default | Yes |
majorgrid.style | stipple pattern used to draw the axis major grids | see the Line Style section of "ahelp chipsopt" | shortdash | Yes |
majorgrid.thickness | Thickness of the axis major grids | 0.5 to 10.0; see the Thickness section of "ahelp chipsopt" | 1 | Yes |
majorgrid.visible | Should major grids be visible | see the Booleans section of "ahelp chipsopt" | false | Yes |
majortick.color | The color to use for major ticks | name or hex; see the Color section of "ahelp chipsopt" | default | Yes |
majortick.count | Default number of ticks to display when major mode is count | Non-negative integer | 4 | Yes |
majortick.interval | Spacing to use between ticks when major mode is interval | Non-negative value | 10 | Yes |
majortick.length | length of major ticks | Non-negative integer | 1 | Yes |
majortick.mode | Mode of the axis tickmark positioning | arbitrary|count|interval|limits|nice; see the Tick Mode section of "ahelp chipsopt" | limits | Yes |
majortick.style | Style of the axis tickmarks | inside|outside|centered; see the Tick Style section of "ahelp chipsopt" | inside | Yes |
majortick.thickness | Thickness of major ticks | 0.5 to 10.0; see the Thickness section of "ahelp chipsopt" | 1 | Yes |
majortick.visible | Are major ticks visible or hidden | see the Booleans section of "ahelp chipsopt" | true | Yes |
minorgrid.color | Color of the axis minor grids | name or hex; see the Color section of "ahelp chipsopt" | default | Yes |
minorgrid.style | stipple pattern used to draw the axis minor grids | see the Line Style section of "ahelp chipsopt" | dot | Yes |
minorgrid.thickness | Thickness of the axis minor grids | 0.5 to 10.0; see the Thickness section of "ahelp chipsopt" | 1 | Yes |
minorgrid.visible | Should minor grids be visible | see the Booleans section of "ahelp chipsopt" | false | Yes |
minortick.color | The color to use for minor ticks | name or hex; see the Color section of "ahelp chipsopt" | default | Yes |
minortick.count | Default number of ticks to display when minor mode is count | Non-negative integer | 4 | Yes |
minortick.interval | Spacing to use between ticks when minor mode is interval | Non-negative value | 10 | Yes |
minortick.length | length of minor ticks | Non-negative integer | 1 | Yes |
minortick.mode | Mode of the axis tickmark positioning | arbitrary|count|interval|limits|nice; see the Tick Mode section of "ahelp chipsopt" | nice | Yes |
minortick.style | Style of the axis tickmarks | inside|outside|centered; see the Tick Style section of "ahelp chipsopt" | inside | Yes |
minortick.thickness | Thickness of minor ticks | 0.5 to 10.0; see the Thickness section of "ahelp chipsopt" | 1 | Yes |
minortick.visible | Are minor ticks visible or hidden | see the Booleans section of "ahelp chipsopt" | true | Yes |
offset.parallel | axis label offset from axis start (-.5) to axis end (.5) | -0.5 to 0.5 inclusive; 0 is the center and -0.5/+0.5 refer to the edges | 0 | Yes |
offset.perpendicular | axis label offset from axis baseline in pixels | -100 to 100, inclusive | 40 | Yes |
pad | The percentage of padding to add to an axis in arbitrary limits or interval modes | Non-negative value | 0.05 | Yes |
thickness | Thickness of the axis | 0.5 to 10.0; see the Thickness section of "ahelp chipsopt" | 1 | Yes |
tickformat | print format for axis ticklabels | alphanumeric; see the Tick Format section of "ahelp chipsopt" | %g | Yes |
ticklabel.angle | angle, in degrees, of the axis ticklabel | -360.0 to 360.0 | 0 | Yes |
ticklabel.color | Color of the axis ticklabels | name or hex; see the Color section of "ahelp chipsopt" | default | Yes |
ticklabel.font | font for the axis ticklabel text | helvetica|courier|times|greek; see the Font section of "ahelp chipsopt" | helvetica | Yes |
ticklabel.fontstyle | style of the axis ticklabel text | normal|bold|italic|bolditalic; see the Font Style section of "ahelp chipsopt" | normal | Yes |
ticklabel.halign | Horizontal location of the string reference point of the axis ticklabel | auto|base|center|left|right|top; see the Text Alignment section of "ahelp chipsopt" | center | Yes |
ticklabel.offset | Offset of ticklabels to axis base (in pixels) | Non-negative value | 6 | Yes |
ticklabel.size | Font size of the axis ticklabel | 1 to 100 | 12 | Yes |
ticklabel.style | Style of the axis ticklabels | inside, outside | outside | Yes |
ticklabel.valign | Vertical location of the string reference point of the axis ticklabel | auto|base|center|left|right|top; see the Text Alignment section of "ahelp chipsopt" | center | Yes |
ticklabel.visible | Should ticklabels be visible | see the Booleans section of "ahelp chipsopt" | true | No |
x.label.text | The text used for the X axis label | A text label with limited support for LaTeX commands; see the Text Formatting section of "ahelp chipsopt". | Yes | |
x.label.angle | The angle used for the X axis label | 0 is horizontal, 90 is vertical with text reading from bottom to top, and 270 is vertical with text reading from top to bottom. | 0 | Yes |
x.stem | stem used for x axis id | An alpha-numeric character sequence that does not contain a space | ax | No |
y.label.text | The text used for the Y axis label | A text label with limited support for LaTeX commands; see the Text Formatting section of "ahelp chipsopt". | Yes | |
y.label.angle | The angle used for the Y axis label | 0 is horizontal, 90 is vertical with text reading from bottom to top, and 270 is vertical with text reading from top to bottom. | 90 | Yes |
y.stem | stem used for y axis id | An alpha-numeric character sequence that does not contain a space | ay | No |
The label.angle field
The label.angle field was removed in CIAO 4.6; the x.label.angle and y.label angle fields should be used instead.
Bugs
See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.
See Also
- axes
- add_axis, bind_axes, current_axis, delete_axis, display_axis, display_major_ticks, display_minor_ticks, get_xaxis, get_yaxis, hide_axis, hide_major_ticks, hide_minor_ticks, lin_scale, log_scale, move_axis, reverse_axes, set_arbitrary_tick_positions, set_axis, set_xaxis, set_yaxis, shuffle_axis, unbind_axes
- concepts
- setget
- utilities
- set_current