About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2008

URL: http://cxc.harvard.edu/chips4.1/add_plotarea.py.html
AHELP for ChIPS 4.1

add_plotarea

Context: py.chips

Synopsis

Creates a plot.

Syntax

add_plotarea( [ChipsId,] [,attributes])
add_plotarea( [ChipsId,] px1, py1, px2, py2, [,attributes] )

Description

  • ChipsId - an optional ChipsId structure containing values to modify the currency state for the command.
  • px1, py1, px2, py2 - the location of the lower left (px1,py1) and upper right (px2,py2) corners of the plot. These doubles are in Frame Normalized Coordinates.
  • attributes - optional parameters which allow the user to configure window properties though a structure, list, or attribute string.

The add_plotarea command creates a plot whose attributes are specified by user preferences or in an attribute list. The new plot becomes current by default; providing a ChipsId overrides the currency state. It is identical to the add_plot command ("ahelp add_plot") .

The plot is the object which contains axes, curves, contours, and histograms.

The lower left and upper right corner of the plot area can be specified by the add_plotarea() argument values (px1, py1) and (px2, py2). Otherwise a plot area is created with margins between the plot border and the frame specified by the four margin attributes: leftmargin, rightmargin, topmargin and bottommargin.

Plot Borders

Plot borders have three styles: open, box, and closed.

  • open: a plot with no borders
  • box: a plot with four simple lines as borders
  • closed: a plot with four border lines and tick marks

The corners where two lines meet have four styles: miter, bevel, fill, and notch.

  • miter: the end of the axes meet at an angle to form the corner. The slope where the two faces join depends upon the thickness of the two lines
  • bevel: connect the outside corners of the two lines; miter the inside faces to the bevel
  • fill: outside corner with one line drawn over the other
  • notch: leave the corners open

Plot Titles

The plot title is currently not an attribute of the add_plotarea command. It is set with the set_plot_title command:

set_plot_title("Figure 1")
      

The title is an alphanumeric string, and Latex formatting is allowed. There are many attributes to customize the title via the add_plotarea or set_plot commands: position, depth, horizontal and vertical alignment, angle, color, size, font and fontstyle.

Clipping

Axes, curves, lines, points and labels in data or plot normalized coordinates are clipped at the window boundaries. Only items in data coordinate systems and lines with the extend property turned on are clipped by the plot border.

Customizing the Plot

There are several attributes that control the plot characteristics. The attributes can be set to the ChIPS defaults, values provided in the add_plotarea command, or values from the user's preference file.

The attributes may also be modified with the set_plot command at any time; see "ahelp set_plot" and "ahelp setget" for more information.

The attributes associated with plots are:

Attribute Description Options Default
bottommargin The distance, in Frame Normalized coordinates, between the bottom plot border and the bottom border of the frame containing the plot Real values ranging from zero through one 0.15
corner.style border corner style miter|bevel|fill|notch; see above for descriptions miter
leftmargin The distance, in Frame Normalized coordinates, between the left plot border and the left border of the frame containing the plot Zero through one 0.15
rightmargin The distance, in Frame Normalized coordinates, between the right plot border and the right border of the frame containing the plot Real values ranging from zero through one 0.10
stem stem used for plot id alphanumeric plt
style border style open|box|closed; see above for descriptions closed
title.angle Angle at which the plot title is drawn -360.0:360.0 0.0
title.color Color of the plot title text string name or hex; see the Color section of "ahelp chipsopt" white
title.depth Integer value indicating the depth of the plot title see the Depth section of "ahelp chipsopt" 100
title.font Plot title font helvetica|courier|times|greek; see the Font section of "ahelp chipsopt" helvetica|courier|times
title.fontstyle Specific attributes of the text string independent of size or font normal|bold|italic|bolditalic; see the Font Style section of "ahelp chipsopt" normal
title.halign Horizontal location of the string reference point of the plot title auto|base|center|left|right|top; see the Text Alignment section of "ahelp chipsopt" center
title.size Font size of the plot title 1:100 16
title.valign Vertical location of the string reference point of the plot title auto|base|center|left|right|top; see the Text Alignment section of "ahelp chipsopt" auto
title.xpos X position, in Frame Normalized coordinates, of the reference point of the plot title Real values ranging from zero through one 0.5
title.ypos Y position, in Frame Normalized coordinates, of the reference point of the plot title Real values ranging from zero through one 1.05
topmargin The distance, in Frame Normalized coordinates, between the upper plot border and the upper border of the frame containing the plot Real values ranging from zero through one 0.10

Example 1

chips> add_plotarea()

Simple add_plotarea using the ChIPS defaults for the attribute values.

Example 2

chips> add_plotarea(.2, .2, .7, .7)

The size and location of the plot are indicated by the two XY pairs in the argument list of add_plotarea().

Example 3

chips> settings = ChipsPlot()
chips> settings.corner.style = 'bevel'
chips> settings.style = 'box'
chips> settings.stem = 'MyPlot'
chips> add_plotarea(settings)

Populate the "settings" structure with the attribute values, then add the plot. The plot has a simple border with beveled corners.

Example 4

chips> add_plotarea(['style', 'closed', 'corner.style', 'miter'])

Add a plot with mitered corners, specifying the attribute values in a list.

Bugs

See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.

Last modified: December 2008



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.