當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python matplotlib HandlerBase用法及代碼示例

本文簡要介紹 python 語言中 matplotlib.legend_handler.HandlerBase 的用法。

用法

class matplotlib.legend_handler.HandlerBase(xpad=0.0, ypad=0.0, update_func=None)

默認圖例處理程序的基類。

派生類旨在重寫 create_artists 方法,該方法具有以下簽名:

def create_artists(self, legend, orig_handle,
                   xdescent, ydescent, width, height, fontsize,
                   trans):

重寫的方法需要創建適合給定尺寸(xdescent、ydescent、width、height)的給定變換的藝術家,必要時按字體大小縮放。

參數
xpad 浮點數,可選

x 方向的填充。

ypad 浮點數,可選

y 方向的填充。

update_func 可調用的,可選的

用於從另一個圖例處理程序更新圖例處理程序屬性的函數,由 update_prop 使用。

相關用法


注:本文由純淨天空篩選整理自skytowner.com大神的英文原創作品 matplotlib.legend_handler.HandlerBase。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。