Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: August 2013

URL: http://cxc.harvard.edu/chips/ahelp/chips_pyplot.html
AHELP for CIAO 4.9 ChIPS v1

chips_pyplot

Context: contrib

Synopsis

A basic matplotlib/pyplot-like interface to ChIPS

Syntax

import chips_contrib.pyplot as plt

See help(plt) for information on supported commands

Description

This module provides a very basic pyplot interface to ChIPS, and is intended for those users who know the matplotlib pyplot API and want to do some simple plotting in ChIPS. It is not intended to be a faithful emulation of matplotlib, and many routines or capabilities are either partly or not supported. The module is provided as part of the CIAO contributed scripts package.

Loading the routines

The module can be loaded into ChIPS, Sherpa or Python scripts by saying:

import chips_contrib.pyplot as plt

Once the module has been loaded use the Python command help(plt) to find out what routines are supported.

Routines from this module and ChIPS can be used together. For example, you can still use the ChIPS GUI to modify the visualizations you have created with commands from this module.

Example

chips> import chips_contrib.pyplot as plt
chips> x = np.arange(0, np.pi, 0.01)
chips> y = np.exp(-(x-2.3)**2/0.01)
chips> yimg = np.repeat(y.reshape(-1,y.size), 200, axis=0)
chips> print(yimg.shape)
(200, 315)
chips> yrnd = np.random.normal(loc=0, scale=0.1, size=yimg.shape)
chips> yimg2 = yimg + yrnd
chips> plt.subplot(211)
chips> plt.imshow(yimg2, origin='lower')
chips> plt.subplot(212)
chips> plt.plot(yimg2[100,:])
chips> plt.plot(yimg2.mean(axis=0), lw=2)

Here we show an example of plotting an image and then profiles of the image below it. The image is created from a one-dimensional gaussian (the y array) that is replicated on each row to form an image (yimg), and then normally-distributed noise is added to form yimg2. This 2D array is then displayed using routines from this module.

Changes in the scripts 4.5.4 (August 2013) release

The chips_contrib.pyplot module is new in this release.

About Contributed Software

This script is not an official part of the CIAO release but is made available as "contributed" software via the CIAO scripts page. Please see this page for installation instructions - such as how to ensure that the parameter file is available.

Bugs

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


Last modified: August 2013
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email:   cxchelp@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2017. All rights reserved.