本文簡要介紹 python 語言中 matplotlib.collections.QuadMesh
的用法。
-
基礎:
_MeshData
,Collection
用於高效繪製四邊形網格的類。
四邊形網格是由 M × N 個相鄰四邊形組成的網格,這些四邊形通過 (M+1, N+1) 頂點網格定義。四邊形 (m, n) 由頂點定義
(m+1, n) ----------- (m+1, n+1) / / / / / / (m, n) -------- (m, n+1)
網格不必是規則的,多邊形不必是凸的。
- 參數:
- coordinates (M+1, N+1, 2) 類似數組
-
頂點。
coordinates[m, n]
指定頂點 (m, n) 的 (x, y) 坐標。 - antialiased 布爾值,默認值:真
- shading {'flat', 'gouraud'},默認:'flat'
注意
與其他
Collection
不同,QuadMesh
的默認pickradius
為0,即contains
檢查測試點是否在任何網格四邊形內。- 參數:
- edgecolors 顏色或顏色列表,默認:
rcParams["patch.edgecolor"]
(默認:'black'
) -
構成集合的每個補丁的邊顏色。可以傳遞特殊值'face' 以使邊顏色與麵顏色匹配。
- facecolors 顏色或顏色列表,默認:
rcParams["patch.facecolor"]
(默認:'C0'
) -
組成集合的每個補丁的麵顏色。
- linewidths 浮點數或浮點數列表,默認值:
rcParams["patch.linewidth"]
(默認值:1.0
) -
組成集合的每個補丁的線寬。
- linestyles str 或元組或其列表,默認:'solid'
-
有效字符串為 ['solid', 'dashed', 'dashdot', 'dotted'、'-'、'--'、'-.'、':']。破折號元組應采用以下形式:
(offset, onoffseq),
其中
onoffseq
是以點為單位的開和關墨水長度的偶數長度元組。例如,請參閱線條樣式。 - capstyle
CapStyle
- 類似,默認值:rcParams["patch.capstyle"]
-
用於為集合中的所有路徑設置線的樣式。允許的值為 {'butt', 'projecting', 'round'}。
- joinstyle
JoinStyle
- 類似,默認值:rcParams["patch.joinstyle"]
-
用於連接集合中所有路徑的線條的樣式。允許的值為 {'miter', 'round', 'bevel'}。
- antialiaseds 布爾或布爾列表,默認:
rcParams["patch.antialiased"]
(默認:True
) -
是否應使用抗鋸齒繪製集合中的每個補丁。
- offsets (float, float) 或其列表,默認:(0, 0)
-
渲染後翻譯每個補丁的向量(默認為無翻譯)。平移是在屏幕(像素)坐標中執行的(即在應用藝術家的變換之後)。
- offset_transform
Transform
,默認:IdentityTransform
-
在使用每個
offsets
向量之前將其應用於單個變換。 - cmap, norm
-
數據標準化和顏色映射參數。有關詳細說明,請參閱
ScalarMappable
。 - hatch str,可選
-
填充路徑中使用的填充圖案(如果有)。有效字符串為 ['/'、''、'|'、'-'、'+'、'x', 'o'、'O'、'.'、'*']。有關每種影線類型的含義,請參閱影線樣式參考。
- pickradius 浮點數,默認值:5.0
-
如果
pickradius <= 0
,則每當測試點位於由集合中路徑的控製點形成的多邊形之一內部時,Collection.contains
將返回True
。另一方麵,如果它大於 0,則我們檢查測試點是否包含在集合中任何路徑後麵的寬度為2*pickradius
的筆劃中。 - urls str 列表,默認值:無
-
繪製後要鏈接到的每個補丁的 URL。目前僅適用於 SVG 後端。有關示例,請參閱超鏈接。
- zorder 浮點數,默認值:1
-
繪圖順序,由集合中的所有補丁共享。有關所有默認值和示例,請參閱 Zorder 演示。
- edgecolors 顏色或顏色列表,默認:
用法
class matplotlib.collections.QuadMesh(coordinates, *, antialiased=True, shading='flat', **kwargs)
相關用法
- Python matplotlib QuadMesh.set_hatch用法及代碼示例
- Python matplotlib QuadMesh.sticky_edges用法及代碼示例
- 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用法及代碼示例
- Python matplotlib Axes.semilogx用法及代碼示例
- Python matplotlib Axes.semilogy用法及代碼示例
- Python matplotlib MovieWriterRegistry.register用法及代碼示例
- Python matplotlib PolyQuadMesh.set_hatch用法及代碼示例
- Python matplotlib warn_deprecated用法及代碼示例
- Python matplotlib Text.set_bbox用法及代碼示例
注:本文由純淨天空篩選整理自skytowner.com大神的英文原創作品 matplotlib.collections.QuadMesh。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。