Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: 14 December 2016

How do I change the appearance/location of the plot title?


The set_plot command is used to change the appearance of the plot title. First we use get_plot to display the current settings and then change the size and location of the title (so that it is left-justified to the plot):

chips> get_plot().title

angle = 0.0
color = default
depth = 100
font = helvetica
fontstyle = normal
halign = 0.5
size = 16
valign = 0.5
xpos = 0.5
ypos = 15.0
chips> set_plot(["title.size", 20, "title.halign", 0, "title.xpos", 0])

The control point of the title with respect to the top border of the axis is controlled by the xpos and ypos title attributes. The coordinate systems for the two directions are different; xpos=0 refers to the left edge of the plot and xpos=1 the right edge (the value can extend outside this range), whereas ypos is measured in pixels, so ypos=0 lies on the top border, ypos=20 is 20 pixels above the border, and ypos=-40 lies 40 pixels below the border.

The location of the control point with respect to the label is governed by the halign and valign attributes; halign=0 is left justified, halign=0.5 centered, and halign=1 is right justified. The y alignment is with respect to the baseline of the font.

The following commands and visualization illustrate some of the position options of a plot title:

[A 2 by 2 grid of plots showing some of the title position options]
chips> clear()
chips> add_window(8, 8, "inches")
chips> split(2, 2, 0.1, 0.1)
chips> current_plot("all")
chips> set_plot_title("A plot title")
chips> set_plot(["style", "boxed"])
chips> current_plot("plot1")
chips> set_plot(["title.xpos", 0, "title.halign", 0.5])
chips> add_label(0.5, 0.5, "plot1")
chips> current_plot("plot3")
chips> set_plot(["title.xpos", 0, "title.halign", 0])
chips> add_label(0.5, 0.5, "plot3")
chips> current_plot("plot2")
chips> set_plot(["title.xpos", 1, "title.halign", 1, "title.ypos", 0, "title.valign", 1])
chips> add_label(0.5, 0.5, "plot2")
chips> current_plot("plot4")
chips> set_plot(["title.ypos", 0])
chips> add_label(0.5, 0.5, "plot4")

The ChIPS GUI

The ChIPS GUI makes it easy to modify a visualization using your mouse, rather than Python functions. The GUI can also be used to add annotations - such as labels, lines, points and regions - and to zoom or pan into plots.



Last modified: 14 December 2016
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.