matplotlib tutorial (5) nitta@tsuda.ac.jp

Chapter 5: Draw text in the graph area.

5-1: Plot text in the graph area (pyplot.text)

Use Axes.text(x, y, text, ...) to draw a text.

for boxed text, pass the attributes in dictionary fromat to the bbox parameter.

5-2: Display labels on all data points (transorms.offset_copy)

The value for each marker is displayed as its label on the scatter diagram in which the markers are plotted. It is convenient to set the offset information in a batch by using the Transform object that manages the offset information of the Axes object.

5-3: Annotate the graph using annotate.

Text with arrows can be drawn anywhere on the graph.

5-4: Display annotations using arrow-shaped boxes, using Axes.text()

5-5: Draw a formula

The formula is written in the pair of '$' in the string following the letter 'r'.