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

Skip the navigation links
Last modified: 10 December 2007

URL: http://cxc.harvard.edu/chips4.0/gallery/axes.py.html
Hardcopy (PDF): A4 | Letter

Gallery: Axis styles and grids (Python)

Examples


The default plot style is to show all four axes (closed)

[ChIPS output]
Postscript version
add_curve("atan.fits[cols X,Y]",["symbol.style","none"])

The open plot style only displays two axes

[ChIPS output]
Postscript version
plt = ChipsPlot()
plt.style = "open"
crv = ChipsCurve()
crv.symbol.style = "none"
add_curve("atan.fits[cols X,Y]",[plt,crv])

The boxed plot style draws a box arount the plot

[ChIPS output]
Postscript version
plt = ChipsPlot()
plt.style = "boxed"
crv = ChipsCurve()
crv.symbol.style = "none"
add_curve("atan.fits[cols X,Y]",[plt,crv])

# We hide the axes to show the box surrounding the plot
hide_axis()

set_plot(["leftmargin",0.1,"bottommargin",0.1])

Numeric labels (ticklabels) on all four axes

[ChIPS output]
Postscript version
add_curve("atan.fits[cols X,Y]",["symbol.style","none"])

set_plot(["rightmargin",0.15])

set_axis_ticklabel_offset("all",10)
set_axis_ticklabel_visible("all",1)

Rotating the numbers along an axis

[ChIPS output]
Postscript version
add_curve("aspect.fits[cols ra,dec]",["symbol.style","none"])

set_xaxis(["ticklabel.angle",40.0])
set_axis_ticklabel_offset("ax1",16)

Changing the format used to display the labels

[ChIPS output]
Postscript version
add_curve("aspect.fits[cols time,roll]",["symbol.style","none"])

set_plot(["bottommargin",0.25])

set_yaxis(["tickformat","%.3f"])

set_xaxis(["tickformat","%.5z"])
set_xaxis(["ticklabel.angle",40.0])
set_axis_ticklabel_offset("ax1",30)

set_axis(["ticklabel.fontstyle","bolditalic"])

Using sexagesimal notation for the axis labels

[ChIPS output]
Postscript version
add_curve("aspect.fits[cols ra,dec]",["symbol.style","none"])

set_xaxis(["tickformat","ra"])
set_yaxis(["tickformat","dec"])

Changing the number of major tick marks (using mode=interval)

[ChIPS output]
Postscript version
add_curve("aspect.fits[cols ra,dec]",["symbol.style","none"])

set_xaxis(["majortick.interval",5.0e-3,"majortick.mode","interval"])

ay = ChipsAxis()
ay.majortick.interval = 2.0e-3
ay.majortick.mode = "interval"
ay.minortick.count = 3
set_yaxis(ay)

Changing the number of major tick marks (using mode=count)

[ChIPS output]
Postscript version
add_curve("aspect.fits[cols ra,dec]",["symbol.style","none"])

set_axis(["majortick.count",4,"majortick.mode","count"])

# Override the minortick.count setting for the Y axis
set_yaxis(["minortick.count",3])

Displaying a grid at the major tick mark locations

[ChIPS output]
Postscript version
add_curve("atan.fits[cols X,Y]",["symbol.style","none"])

set_axis(["majorgrid.visible",1,"majorgrid.style","dot"])

Add a grid at the major and minor tick mark locations

[ChIPS output]
Postscript version
crv = ChipsCurve()
crv.symbol.style = "none"
crv.line.thickness = 2
crv.line.color = "red"
add_curve("atan.fits[cols X,Y]",crv)

ax = ChipsAxis()
ax.majortick.mode = "interval"
ax.majortick.interval = 10.0
ax.minortick.count = 1
set_xaxis(ax)
ay = ChipsAxis()
ay.majortick.mode = "interval"
ay.majortick.interval = 1.5
ay.minortick.count = 2
set_yaxis(ay)
set_axis(["majorgrid.visible",1,"minorgrid.visible",1])

limits(Y_AXIS,-1.6,1.6)
Hardcopy (PDF): A4 | Letter
Last modified: 10 December 2007


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.