Last modified: December 2014

URL: https://cxc.cfa.harvard.edu/chips/ahelp/get_xaxis.html
AHELP for CIAO 4.11 ChIPS v1

get_xaxis

Context: axes

Synopsis

Retrieves the attribute value(s) of the X axis.

Syntax

get_xaxis()
get_xaxis(id)
get_xaxis(id, attribute)

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_xaxis command returns a structure containing all the attribute values of the x 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.


Examples

Example 1

chips> add_axis(X_AXIS, 20, 0, 100, "color=yellow")
chips> print(get_xaxis())
chips> print(get_xaxis("ax1","color"))

An axis is created and becomes current. Calling get_xaxis with no argument returns all the attributes of the object. get_xaxis is called a second time to return just the "color" attribute.

Example 2

chips> add_axis(X_AXIS, 20, 0, 100, "color=yellow")
chips> add_axis(XY_AXIS, 40, 0, 100,"color=magenta")
chips> print(get_xaxis("ax1"))

Two axes are created. get_xaxis is called with the id of the first x-axis, returning all attributes.

Example 3

chips> id = ChipsId()
chips> id.xaxis = "ax1"
chips> print(get_xaxis(id))

A ChipsId structure is created and the id.xaxis field is set to "ax1". get_xaxis is called with the ChipsId.

Example 4

chips> ax = get_xaxis()
chips> print(ax)

Retrieve a structure containing the attribute values of the current xaxis and store the results in "ax". Print the contents of "ax".


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_axis, 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