ChimeraX docs icon

Command: 2dlabels

2D labels example

Usage:
2dlabels ( create | change | delete )  name  options

Usage:
2dlabels  listfonts

The 2dlabels command allows adding 2D text and symbols to the display for presentation-quality images and movies. 2D labels exist in the X,Y plane (the plane of the screen) and do not move along with the 3D scene, but they can be repositioned with the move label mouse mode . Dragging a label echoes the corresponding command with X and Y positions to the Log, which may be useful for scripting.

For “3D labels” that move along with the associated atoms, see the label command. See also: save, movie, making images, making movies

Examples:

2dlabels create title text 'Green Fluorescent Protein' color light sea green size 26 xpos .03 ypos .92
2dlab change title ypos .03 size 40
2dlab delete all

For an example image with a script, see G-Protein Switch Regions.

2dlabels create  nametext label-contents ] [ color label-color ] [ size font-size ] [ xpos x-position ] [ ypos y-position ] [ font font-name ] [ bold  true | false ] [ italic  true | false ] [ visibility  true | false ]
The name is required and serves as an identifier for subsequently changing or deleting the 2D label. The label-contents (default nothing) can include letters, numbers, symbols from the keyboard; additional symbols can be copied and pasted into the command line, or indicated with unicode character codes or character names. Unicode examples: Spaces and quote marks can be included by enclosing the entire label-contents in single or double quote marks. Carriage returns are indicated with \n. The label-color can be any color name that specifies a single color (default white). The font-size must be an integer greater than zero (default 24). The x-position and y-position are the X and Y coordinates of the lower lefthand corner of the label (defaults are 0.5 and 0.5). The X axis is horizontal and the Y axis is vertical, and both range from 0 to 1 in the visible portion of the graphics window. It is possible to place a label partially or completely outside the visible area, however. The possible values of font-name (default Arial) can be listed with 2dlabels listfonts. Font names with spaces must be enclosed in quotation marks. In addition, the font can be designated as italic and/or bold. The visibility option specifies whether the label should be displayed when it is created.
2dlabels change  nametext label-contents ] [ color label-color ] [ size font-size ] [ xpos x-position ] [ ypos y-position ] [ font font-name ] [ bold  true | false ] [ italic  true | false ] [ visibility  true | false ]
The 2D label to change is specified by the name it was assigned with create, or the word all can be used to specify all 2D labels collectively. All other options are as described above for create, except the defaults are to leave the current label unchanged.
2dlabels delete  name
The 2D label to delete is specified by the name it was assigned with create, or the word all can be used to specify all 2D labels collectively.
2dlabels listfonts
List the available font names in the Log.

UCSF Resource for Biocomputing, Visualization, and Informatics / October 2018