Use of the text() method of Python drawing plt

Reprinted from: https://blog.csdn.net/u011808596/article/details/121336096?spm=1001.2014.3001.5506
(1) text() method:

plt.text(x, y, string, size, family, color, style, weight, verticalalignment, horizontalalignment, rotation, bbox=dict(facecolor, alpha, boxstyle))

x: the abscissa of the text position

y: The ordinate of the text position

string: text content

size: text font size

family: text font type: such as Song Dynasty, Times new roman, etc.

color: text font color

style: text font style: italic (italic)

weight: text line thickness: light

verticalalignment: vertical alignment, optional ‘center’, ‘top’, ‘bottom’, ‘baseline’, etc.

horizontalalignment: horizontal alignment, you can fill in ‘center’, ‘right’, ‘left’, etc.

rotation: the rotation angle of the label, calculated in counterclockwise direction, rounded

bbox: Text background box settings:

   ( facecolor:背景颜色

    alpha:背景颜色的透明度

    boxstyle:背景框的风格(默认是直角):boxstyle="round"(为圆角)

    )

(2) Case setting:

plt.text(-3, 150, text1, size=12, family=“Times new roman”, color=“black”, style=‘italic’, weight = “light”, bbox=dict(facecolor=“dimgray”, alpha=0.5, boxstyle=“round”))

Hope this helps! Thank you for accepting!

————————————————
Copyright statement: This article is an original article by CSDN blogger "Piaoyu" and follows CC 4.0 BY -SA Copyright Agreement, please attach the original source link and this statement when reprinting.
Original link: https://blog.csdn.net/u011808596/article/details/121336096

Guess you like

Origin blog.csdn.net/haimengjie/article/details/129831982