python文本颜色设置_matplotlib中为文本设置颜色

plt.text(-3, 40, "function: y = x * x", size =

15,\

family = "fantasy",

color = "r", style = "italic", weight =

"light",\

bbox = dict(facecolor = "r",

alpha = 0.2))

属性 描述

agg_filter a filter function, which takes a (m, n, 3) float

array and a dpi value, and returns a (m, n, 3) array

alpha 透明度,float (0.0 transparent透明 through 1.0

opaque不透明)

animated bool

backgroundcolor any matplotlib color

bbox 给字体添加框,alpha 设置框体的透明度,

facecolor 设置框体的颜色FancyBboxPatch prop dict

clip_box a matplotlib.transforms.Bbox instance

clip_on 布尔值bool

clip_path [ (Path, Transform) | Patch | None ]

color 字体颜色any

matplotlib color

contains a callable function

family or fontfamily or fontname or name 字体[FONTNAME | ‘serif’

| ‘sans-serif’ | ‘cursive’ | ‘fantasy’ | ‘monospace’ ]

figure a Figure instance

fontproperties or font_properties a

matplotlib.font_manager.FontProperties instance

gid an id string

horizontalalignment or ha [ ‘center’ | ‘right’ | ‘left’

]

label object

linespacing float (multiple of font size)

multialignment or ma [‘left’ | ‘right’ | ‘center’ ]

path_effects AbstractPathEffect

picker [None | bool | float | callable]

position (x,y)

rasterized bool or None

rotation [ angle in degrees | ‘vertical’ | ‘horizontal’

]

rotation_mode [ None | “default” | “anchor” ]

size or fontsize 字体大小[size in points | ‘xx-small’ | ‘x-small’

| ‘small’ | ‘medium’ | ‘large’ | ‘x-large’ | ‘xx-large’ ]

sketch_params (scale: float, length: float, randomness:

float)

snap bool or None

stretch or fontstretch [a numeric value in range 0-1000 |

‘ultra-condensed’ | ‘extra-condensed’ | ‘condensed’ |

‘semi-condensed’ | ‘normal’ | ‘semi-expanded’ | ‘expanded’ |

‘extra-expanded’ | ‘ultra-expanded’ ]

style or fontstyle [ ‘normal’ | ‘italic’ | ‘oblique’]

text string or anything printable with ‘%s’ conversion.

transform Transform

url a url string

usetex bool or None

variant or fontvariant [ ‘normal’ | ‘small-caps’ ]

verticalalignment or va [ ‘center’ | ‘top’ | ‘bottom’ |

‘baseline’ ]

visible bool

weight or fontweight 字体粗细[a numeric value in range 0-1000 |

‘ultralight’ | ‘light’ | ‘normal’ | ‘regular’ | ‘book’ | ‘medium’ |

‘roman’ | ‘semibold’ | ‘demibold’ | ‘demi’ | ‘bold’ | ‘heavy’ |

‘extra bold’ | ‘black’ ]

wrap bool

x float

y float

zorder float