|
|
|
|
Concepts: Coordinates
ChIPS' coordinate systemsThere are five coordinate systems in ChIPS:
All objects (except for windows) are positioned in a coordinate system. Once an object is added to a coordinate system, it is always associated with that coordinate system. There is no way to change the coordinate system to which an object belongs after it has been created. For most objects, the coordinate system that will be used is predetermined.
A coordinate system becomes current and accessible when the object which defines it becomes current and accessible. Only the current coordinate systems are considered when determining the default system. Creating and Deleting SystemsCoordinate systems are created with the objects which define them.
Deleting an object removes the coordinate system and any objects associated with that coordinate system. BindingThe object becomes bound to the coordinate system in which it is positioned. Adjusting the coordinate system (i.e. changing the boundaries) causes the object position to shift accordingly. For example, a point added to a window normalized coordinate system will be repositioned if the window size changes. ClippingA coordinate system may clip an object, e.g. hide the part of the object which falls outside of the coordinate system boundaries. Objects in data coordinates may be clipped at the boundary of the plot area. Objects in any other coordinate system may be clipped at the frame edge. The info_coordinate CommandThe info_coordinate command (S-Lang or Python help) provides a means of seeing what data coordinate systems exist, where they reside, and the ids associated with them. Converting Between Systems
Using the coordsys attribute
# Python add_label(0.05, 0.9, "Label", ["coordsys", FRAME_NORM]) % S-Lang add_label(0.05, 0.9, "Label", {"coordsys", FRAME_NORM}); This is an alternative to using the coord_sys field of a ChipsId object. Using a ChipsId objectThe ChipsId object (Python or S-Lang) allows the user to set or modify the currency of ChIPS objects. It also contains entries to specify coordinate systems and coordinate system ids. The ChipsId is optional and is generally the first parameter in the command. The coord_sys entry in the ChipsId is used to specify the coordinate system to use when adding objects. For instance: # Python
add_axis (XY_AXIS, 0, 0, 10)
id = ChipsId()
id.coord_sys = PLOT_NORM
add_label (id, .1, .1, "My label")
% S-Lang
add_axis (XY_AXIS, 0, 0, 10);
id = ChipsId;
id.coord_sys = PLOT_NORM;
add_label (id, .1, .1, "My label");
By default, the label would been added in the data system created by the x and y axis. However, setting the ChipsId's the coord_sys entry to PLOT_NORM causes it to be added in plot normalized coordinates. The ChipsId also has a coord field, which can be populated with a data system id. When a data system is created, an id string is associated with it. The string is formatted as the plot id, an underscore, and the x axis id and y axis id, e.g. "plot1_ax1ay1". Both the coord and coord_sys need to be set when adding an annotation to a data system which is not the default. # Python
add_axis (XY_AXIS, 0, 0, 10)
add_axis (XY_AXIS, 0, 0, 1000)
id = ChipsId()
id.coord_sys = DATA
id.coord = "plot1_ax2ay2"
add_label (id, 500, 500, "My label")
% S-Lang
add_axis (XY_AXIS, 0, 0, 10);
add_axis (XY_AXIS, 0, 0, 1000);
id = ChipsId;
id.coord_sys = DATA;
id.coord = "plot1_ax2ay2";
add_label (id, 500, 500, "My label");
The label was added to the data system defined by the second set of axes created (plot1_ax2ay2). |
![]() |
The Chandra X-Ray
Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA. Email: cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2004. All rights reserved. |