|
|
|
|
Gallery: Adding axes (Python)Examples
Using a line to indicate an axis
add_curve("atan.fits[cols X,Y]",["symbol.style","none"])
add_hline(0.0)
Adding an extra axis to a plot
add_curve("atan.fits[cols X,Y]",["symbol.style","none"])
add_axis(X_AXIS,0.0,1.0,10.0)
bind_axes("ax1","ax2")
# Set the tick marks on the new axis to extend to both sides
axis = ChipsAxis()
axis.majortick.style = "centered"
axis.minortick.style = "centered"
axis.majortick.length = 10
axis.minortick.length = 6
set_axis("ax2",axis)
set_axis_ticklabel_visible("ax2",0)
A single plot containing two datasets with a common axis
set_preference("curve.symbol.style","none")
add_window(6.0,3.0)
add_curve("aspect.fits[cols time,ra]")
set_plot_xlabel("Time (s)")
set_plot_ylabel("RA (degrees)")
# Place the second Y axis at the right-edge of the plot
cid = ChipsId()
cid.coord_sys = PLOT_NORM
add_axis(cid,Y_AXIS,1.0,1.0,10.0)
add_curve("aspect.fits[cols time,dec]",["line.color","red"])
limits(Y_AXIS,AUTO,AUTO)
set_plot_ylabel("Dec (degrees)")
set_yaxis(["label.color","red","ticklabel.color","red"])
reposition_plot(0.2,0.2,0.8,0.93)
ax = ChipsAxis()
ax.majortick.interval = 1000.0
ax.tickformat = "%.0f"
ax.offset.perpendicular = 30
set_xaxis(ax)
ay = ChipsAxis()
ay.majortick.interval = 5.0e-3
ay.tickformat = "%.3f"
ay.minortick.count = 4
ay.offset.perpendicular = 60
set_yaxis("ay1",ay)
ay = ChipsAxis()
ay.majortick.interval = 2.0e-3
ay.tickformat = "%.3f"
ay.minortick.count = 3
ay.offset.perpendicular = 60
set_yaxis("ay2",ay)
set_axis("all",["majortick.mode","interval"])
Two y axes on the left of the plot
set_preference("curve.symbol.style","none")
set_preference("axis.offset.perpendicular","30")
add_window(6.0,3.0)
add_curve("aspect.fits[cols time,ra]",["plot.style","open"])
reposition_plot(0.25,0.25,0.95,0.9)
set_xaxis(["majortick.interval",1000.0,"tickformat","%.0f"])
ay = ChipsAxis()
ay.ticklabel.angle = 45.0
ay.majortick.interval = 5.0e-3
ay.tickformat = "%.3f"
ay.minortick.count = 4
set_yaxis(ay)
add_label(6.80096e7,259.258,"RA")
# Place the second Y axis to the left of the original axis
cid = ChipsId()
cid.coord_sys = FRAME_NORM
add_axis(cid,Y_AXIS,0.12,1.0,10.0)
add_curve("aspect.fits[cols time,dec]",["line.color","red"])
limits(Y_AXIS,AUTO,AUTO)
add_label(6.80096e7,67.1965,"Dec",["color","red"])
set_cascading_property("ay2",chips_axis,"color","\"red\"")
ay = ChipsAxis()
ay.ticklabel.angle = 45.0
ay.majortick.interval = 2.0e-3
ay.tickformat = "%.3f"
ay.minortick.count = 3
ay.offset.perpendicular = 60
set_yaxis(ay)
set_axis("all",["majortick.mode","interval"])
set_plot_xlabel("Time (s)")
|
![]() |
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. |