本文簡要介紹 python 語言中 matplotlib.textpath.TextPath
的用法。
-
從文本創建路徑。
從文本創建路徑。請注意,它隻是一條路徑,而不是藝術家。您需要使用
PathPatch
(或其他藝術家)將此路徑繪製到畫布上。- xy 兩個浮點值的元組或數組
-
文本的位置。對於無偏移,請使用
xy=(0, 0)
。 - s str
-
要轉換為路徑的文本。
- size 浮點數,可選
-
字體大小以磅為單位。默認為通過字體屬性
prop
指定的大小。 - prop
matplotlib.font_manager.FontProperties
,可選 -
字體屬性。如果未提供,將使用帶有來自 rcParams 的參數的默認
FontProperties
。 - _interpolation_steps 整數,可選
-
(目前被忽略)
- usetex 布爾值,默認值:假
-
是否使用 tex 渲染。
參數
例子
下麵從字符串 "ABC" 中創建一個帶有 Helvetica 字體的路徑;以及乳膠部分 1/2 的另一條路徑:
from matplotlib.textpath import TextPath from matplotlib.font_manager import FontProperties fp = FontProperties(family="Helvetica", style="italic") path1 = TextPath((12, 12), "ABC", size=12, prop=fp) path2 = TextPath((0, 0), r"$\frac{1}{2}$", size=12, usetex=True)
另請參閱使用文本作為路徑。
用法
class matplotlib.textpath.TextPath(xy, s, size=None, prop=None, _interpolation_steps=1, usetex=False)
相關用法
- Python matplotlib Text.set_bbox用法及代碼示例
- Python matplotlib TextToPath.get_text_path用法及代碼示例
- Python matplotlib TexManager.get_rgba用法及代碼示例
- Python matplotlib ToolManager.toolmanager_disconnect用法及代碼示例
- Python matplotlib TriMesh.sticky_edges用法及代碼示例
- Python matplotlib TwoSlopeNorm用法及代碼示例
- Python matplotlib Table.edges用法及代碼示例
- Python matplotlib TriMesh.set_hatch用法及代碼示例
- Python matplotlib Transform.__sub__用法及代碼示例
- Python matplotlib Table.set_fontsize用法及代碼示例
- Python matplotlib axvspan用法及代碼示例
- Python matplotlib Axes.get_legend_handles_labels用法及代碼示例
- Python matplotlib AbstractMovieWriter用法及代碼示例
- Python matplotlib triplot用法及代碼示例
- Python matplotlib StarPolygonCollection.set_hatch用法及代碼示例
- Python matplotlib boxplot用法及代碼示例
- Python matplotlib subplots用法及代碼示例
- Python matplotlib InsetPosition用法及代碼示例
- 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.textpath.TextPath。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。