matplotlib.patches.Ellipse#

class matplotlib.patches.Ellipse(xy, width, height, *, angle=0, **kwargs)[源代码][源代码]#

基类:Patch

一个无标度椭圆。

参数:
xy(浮点数, 浮点数)

椭圆中心的xy坐标。

宽度浮动

水平轴的总长度(直径)。

高度浮动

垂直轴的总长度(直径)。

角度float, 默认值: 0

逆时针旋转的度数。

注释

有效的关键字参数是:

属性

描述

agg_filter

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

alpha

未知

animated

布尔值

抗锯齿 或 aa

布尔值或无

capstyle

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

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

补丁或(路径,变换)或无

颜色

color

edgecolor 或 ec

color or None

facecolor 或 fc

color or None

figure

FigureSubFigure

填充

布尔值

gid

str

hatch

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

in_layout

布尔值

joinstyle

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

标签

对象

线型 或 ls

{'-', '--', '-.', ':', '', (偏移, 开关序列), ...}

linewidth 或 lw

浮点数或无

鼠标悬停

布尔值

路径效果

AbstractPathEffect 列表

picker

None 或 bool 或 float 或 callable

光栅化

布尔值

sketch_params

(scale: float, length: float, randomness: float)

snap

布尔值或无

transform

Transform

url

str

可见

布尔值

zorder

浮动

property angle#

返回椭圆的角度。

property center#

返回椭圆的中心。

get_angle()[源代码][源代码]#

返回椭圆的角度。

get_center()[源代码][源代码]#

返回椭圆的中心。

get_co_vertices()[源代码][源代码]#

返回椭圆的共顶点坐标。

定义可以在 这里 找到

Added in version 3.8.

get_corners()[源代码][源代码]#

返回椭圆边界框的角点。

边界框的方向是从旋转前定义的左下角开始逆时针移动。

get_height()[源代码][源代码]#

返回椭圆的高度。

get_patch_transform()[源代码][源代码]#

返回将补丁坐标映射到数据坐标的 Transform 实例。

例如,可以通过提供单位圆的坐标和将坐标(补丁坐标)缩放5倍的变换来定义一个表示半径为5的圆的补丁。

get_path()[源代码][源代码]#

返回椭圆的路径。

get_vertices()[源代码][源代码]#

返回椭圆的顶点坐标。

定义可以在 这里 找到

Added in version 3.8.

get_width()[源代码][源代码]#

返回椭圆的宽度。

property height#

返回椭圆的高度。

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>, height=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<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

角度

浮动

animated

布尔值

抗锯齿 或 aa

布尔值或无

capstyle

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

中心

(浮点数, 浮点数)

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

补丁或(路径,变换)或无

颜色

color

edgecolor 或 ec

color or None

facecolor 或 fc

color or None

figure

FigureSubFigure

填充

布尔值

gid

str

hatch

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

高度

浮动

in_layout

布尔值

joinstyle

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

标签

对象

线型 或 ls

{'-', '--', '-.', ':', '', (偏移, 开关序列), ...}

linewidth 或 lw

浮点数或无

鼠标悬停

布尔值

路径效果

AbstractPathEffect 列表

picker

None 或 bool 或 float 或 callable

光栅化

布尔值

sketch_params

(scale: float, length: float, randomness: float)

snap

布尔值或无

transform

Transform

url

str

可见

布尔值

宽度

浮动

zorder

浮动

set_angle(angle)[源代码][源代码]#

设置椭圆的角度。

参数:
角度浮动
set_center(xy)[源代码][源代码]#

设置椭圆的中心。

参数:
xy(浮点数, 浮点数)
set_height(height)[源代码][源代码]#

设置椭圆的高度。

参数:
高度浮动
set_width(width)[源代码][源代码]#

设置椭圆的宽度。

参数:
宽度浮动
property width#

返回椭圆的宽度。

使用 matplotlib.patches.Ellipse 的示例#

使用补丁裁剪图像

Clipping images with patches

坐标轴方框比例

Axes box aspect

绘制二维数据集的置信椭圆

Plot a confidence ellipse of a two-dimensional dataset

尺度不变角度标签

Scale invariant angle label

标注图表

Annotate plots

AnnotationBbox 演示

AnnotationBbox demo

Matplotlib 艺术家的参考

Reference for Matplotlib artists

海豚

Dolphins

带方向箭头的椭圆演示

Ellipse with orientation arrow demo

椭圆演示

Ellipse Demo

Hatch 演示

Hatch demo

圆、楔形和多边形

Circles, Wedges and Polygons

ggplot 样式表

ggplot style sheet

灰度样式表

Grayscale style sheet

样式表引用

Style sheets reference

图的结构

Anatomy of a figure

镜子

Looking glass

锚定艺术家

Anchored Artists

自定义投影

Custom projection

打包气泡图

Packed-bubble chart

在3D图中绘制平面物体

Draw flat objects in 3D plot

雷达图(又称蜘蛛图或星形图)

Radar chart (aka spider or star chart)

带有单位的椭圆

Ellipse with units

变换教程

Transformations Tutorial

图例指南

Legend guide

注解

Annotations