seaborn.objects.Norm#
- class seaborn.objects.Norm(func='max', where=None, by=None, percent=False)#
在群組內彙總後,於數值軸上進行除法縮放。
- 參數:
- funcstr 或可調用物件
在每個群組上呼叫以定義比較值的函式。
- wherestr
定義用於定義比較值的子集的查詢字串。
- by變數列表
用於定義彙總群組的變數。
- percentbool
如果為 True,則將結果乘以 100。
範例
預設情況下,此轉換會將每個群組縮放到相對於其最大值的比例
( so.Plot(healthexp, x="Year", y="Spending_USD", color="Country") .add(so.Lines(), so.Norm()) .label(y="Spending relative to maximum amount") )
使用
where
來約束用於定義基準的值,並使用percent
來縮放輸出( so.Plot(healthexp, x="Year", y="Spending_USD", color="Country") .add(so.Lines(), so.Norm(where="x == x.min()", percent=True)) .label(y="Percent change in spending from 1970 baseline") )