本文簡要介紹 python 語言中 matplotlib.patches.Rectangle 的用法。
-
基礎:
Patch通過錨點
xy及其width和height定義的矩形。矩形在 x 方向上從
xy[0]延伸到xy[0] + width,在 y 方向上從xy[1]延伸到xy[1] + height。: +------------------+ : | | : height | : | | : (xy)---- width -----+可以將
xy想象為左下角,但實際上xy是哪個角取決於軸的方向以及width和height的符號;例如如果 x 軸反轉或width為負數,xy將是右下角。- 參數:
- xy (浮點數,浮點數)
-
錨點。
- width 浮點數
-
矩形寬度。
- height 浮點數
-
矩形高度。
- angle 浮點數,默認值:0
-
繞旋轉點逆時針旋轉度數。
- rotation_point {'xy', 'center',(數字,數字)},默認:'xy'
-
如果是
'xy',則圍繞錨點旋轉。如果'center'繞中心旋轉。如果是數字的二元組,則圍繞該坐標旋轉。
- 其他參數:
- **kwargs
Patch屬性 屬性
說明
一個過濾器函數,它接受一個 (m, n, 3) 浮點數組和一個 dpi 值,並返回一個 (m, n, 3) 數組和距圖像左下角的兩個偏移量
unknown
bool
antialiased或 aa布爾或無
CapStyle或 {'butt', 'projecting', 'round'}BboxBase或無bool
補丁或(路徑,變換)或無
color
edgecolor或 ec顏色或無
facecolor或 fc顏色或無
bool
str
{'/'、'\'、'|'、'-'、'+'、'x', 'o'、'O'、'.'、'*'}
bool
JoinStyle或 {'miter', 'round', 'bevel'}object
linestyle或 ls{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth或 lw浮點數或無
bool
None 或 bool 或 float 或可調用
bool
(比例:浮點數,長度:浮點數,隨機性:浮點數)
布爾或無
str
bool
float
- **kwargs
用法
class matplotlib.patches.Rectangle(xy, width, height, *, angle=0.0, rotation_point='xy', **kwargs)
相關用法
- Python matplotlib RectangleSelector用法及代碼示例
- Python matplotlib Rectangle.set_bounds用法及代碼示例
- Python matplotlib RendererAgg.stop_filter用法及代碼示例
- Python matplotlib RendererAgg.restore_region用法及代碼示例
- Python matplotlib RegularPolyCollection.sticky_edges用法及代碼示例
- Python matplotlib RegularPolyCollection.set_hatch用法及代碼示例
- Python matplotlib RegularPolyCollection用法及代碼示例
- Python matplotlib RGBAxes用法及代碼示例
- Python matplotlib axvspan用法及代碼示例
- Python matplotlib Axes.get_legend_handles_labels用法及代碼示例
- Python matplotlib AbstractMovieWriter用法及代碼示例
- Python matplotlib triplot用法及代碼示例
- Python matplotlib StarPolygonCollection.set_hatch用法及代碼示例
- Python matplotlib Axes.hist用法及代碼示例
- Python matplotlib boxplot用法及代碼示例
- Python matplotlib subplots用法及代碼示例
- Python matplotlib InsetPosition用法及代碼示例
- Python matplotlib ToolManager.toolmanager_disconnect用法及代碼示例
- Python matplotlib Figure.set_size_inches用法及代碼示例
- Python matplotlib figlegend用法及代碼示例
- Python matplotlib Axes.step用法及代碼示例
- Python matplotlib Axes.contour用法及代碼示例
- Python matplotlib LassoSelector用法及代碼示例
- Python matplotlib BrokenBarHCollection.set_hatch用法及代碼示例
- Python matplotlib Axes.plot用法及代碼示例
注:本文由純淨天空篩選整理自skytowner.com大神的英文原創作品 matplotlib.patches.Rectangle。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
