matplotlib.patches.Annulus#

class matplotlib.patches.Annulus(xy, r, width, angle=0.0, **kwargs)[源码]#

基类: Patch

一个椭圆环。

参数:
xy(float, float)

环中心的xy坐标。

rfloat or (float, float)

半径,或半轴

  • 如果为浮点数:外圆的半径。

  • 如果为两个浮点数:外椭圆的长轴和短轴。

width浮点数

环形圈的宽度(厚度)。宽度是从外椭圆向内测量的,因此对于内椭圆,半轴由r - width给出。宽度必须小于或等于短半轴。

anglefloat, 默认值: 0

旋转角度,以度为单位(从正x轴逆时针方向)。对于圆形环(即,如果r是标量)则忽略。

**kwargs

关键字参数控制Patch属性

属性

描述

agg_filter

一个过滤函数,它接受一个 (m, n, 3) 浮点数组和一个 dpi 值,并返回一个 (m, n, 3) 数组以及图像左下角的两个偏移量

alpha

未知

animated

布尔值

antialiased or aa

布尔值或 None

capstyle

CapStyle 或 {'butt', 'projecting', 'round'}

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

Patch 或 (Path, Transform) 或 None

color

color

edgecolor or ec

颜色 或 None

facecolor or fc

颜色 或 None

figure

Figure or SubFigure

fill

布尔值

gid

str

hatch

{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}

hatch_linewidth

未知

in_layout

布尔值

joinstyle

JoinStyle 或 {'miter', 'round', 'bevel'}

label

object

linestyle or ls

{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}

linewidth or lw

浮点数或 None

mouseover

布尔值

path_effects

list of AbstractPathEffect

picker

None 或 布尔值 或 浮点数 或 可调用对象

rasterized

布尔值

sketch_params

(scale: 浮点数, length: 浮点数, randomness: 浮点数)

snap

布尔值或 None

transform

变换

url

str

visible

布尔值

zorder

浮点数

property angle#

返回环的角度。

property center#

返回环的中心。

get_angle()[源码]#

返回环的角度。

get_center()[源码]#

返回环的中心。

get_path()[源码]#

返回此补丁的路径。

get_radii()[源码]#

返回环的长半轴和短半轴半径。

get_width()[源码]#

返回环形圈的宽度(厚度)。

property radii#

返回环的长半轴和短半轴半径。

set(*, agg_filter=<UNSET>, alpha=<UNSET>, angle=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, center=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, hatch_linewidth=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, radii=<UNSET>, rasterized=<UNSET>, semimajor=<UNSET>, semiminor=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, width=<UNSET>, zorder=<UNSET>)[源码]#

一次性设置多个属性。

支持的属性包括:

属性

描述

agg_filter

一个过滤函数,它接受一个 (m, n, 3) 浮点数组和一个 dpi 值,并返回一个 (m, n, 3) 数组以及图像左下角的两个偏移量

alpha

浮点数或 None

angle

浮点数

animated

布尔值

antialiased or aa

布尔值或 None

capstyle

CapStyle 或 {'butt', 'projecting', 'round'}

居中

(浮点数, 浮点数)

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

Patch 或 (Path, Transform) 或 None

color

color

edgecolor or ec

颜色 或 None

facecolor or fc

颜色 或 None

figure

Figure or SubFigure

fill

布尔值

gid

str

hatch

{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}

hatch_linewidth

未知

in_layout

布尔值

joinstyle

JoinStyle 或 {'miter', 'round', 'bevel'}

label

object

linestyle or ls

{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}

linewidth or lw

浮点数或 None

mouseover

布尔值

path_effects

list of AbstractPathEffect

picker

None 或 布尔值 或 浮点数 或 可调用对象

radii

float or (float, float)

rasterized

布尔值

semimajor

浮点数

semiminor

浮点数

sketch_params

(scale: 浮点数, length: 浮点数, randomness: 浮点数)

snap

布尔值或 None

transform

变换

url

str

visible

布尔值

width

浮点数

zorder

浮点数

set_angle(angle)[源码]#

设置环的倾斜角度。

参数:
angle浮点数
set_center(xy)[源码]#

设置环的中心。

参数:
xy(float, float)
set_radii(r)[源码]#

设置环的长半轴(a)和短半轴(b)半径。

参数:
rfloat or (float, float)

半径,或半轴

  • 如果为浮点数:外圆的半径。

  • 如果为两个浮点数:外椭圆的长轴和短轴。

set_semimajor(a)[源码]#

设置环的长半轴a

参数:
afloat
set_semiminor(b)[源码]#

设置环的短半轴b

参数:
bfloat
set_width(width)[源码]#

设置环形圈的宽度(厚度)。

宽度是从外椭圆向内测量的。

参数:
width浮点数
property width#

返回环形圈的宽度(厚度)。