Last modified: 12 December 2018

Can I add a label to the bottom right of a plot as an id?


We can use the support for different coordinate systems to place a label outside of the main plot area. We start with a simple plot:

chips> clear()
chips> x = np.arange(100) * 0.1
chips> y = np.sin(x) * np.cos(x)
chips> add_window(8, 6, 'inches')
chips> add_curve(x, y, ['symbol.style', 'none'])

and now want to place a label at the bottom-right corner of the window. Since we have a single frame that covers the window we use the frame-normalized coordinate system, and place a label at a coordinate of (0.95,0.05); we use halign to move the reference point of the label so that this position refers to the right edge of the text (i.e. it is right-aligned).

chips> import time
chips> txt = "{} {}".format(os.getlogin(), time.asctime())
chips> add_label(0.95, 0.05, txt, ['coordsys', FRAME_NORM, 'halign', 1])
chips> set_label(['color', 'brown', 'size', 18])

The result is shown below. We had to import the time module to get the current time; the os module is pre-loaded by ChIPS so we can use it to get the user's name for the label.

[The label 'ciaouser Mon Dec  8 11:58:46 2014' is at the bottom-right of the visualization]