seaborn.FacetGrid()的使用
class seaborn.
FacetGrid
(data, row=None, col=None, hue=None, col_wrap=None, sharex=True, sharey=True, height=3, aspect=1, palette=None, row_order=None, col_order=None, hue_order=None, hue_kws=None, dropna=True, legend_out=True, despine=True, margin_titles=False, xlim=None, ylim=None, subplot_kws=None
用於繪製條件關係的多圖網格。
__init__
(data, row=None, col=None, hue=None, col_wrap=None, sharex=True, sharey=True, height=3, aspect=1, palette=None, row_order=None, col_order=None, hue_order=None, hue_kws=None, dropna=True, legend_out=True, despine=True, margin_titles=False, xlim=None
初始化matplotlib圖和FacetGrid物件。
此類將資料集對映到排列在行和列網格中的多個軸上,這些行對應於資料集中的變數級別。它產生的圖通常被稱為“格子”,“格子”或“小多”圖形。
它還可以用色調引數表示第三個變數的級別,該引數繪製不同顏色的不同資料子集。這使用顏色來解析第三維上的元素,但僅在彼此之上繪製子集,並且不會像接受色調的軸級函式那樣為特定視覺化定製hue引數。
當使用從資料集推斷語義對映的seaborn函式時,必須注意在各個方面之間同步這些對映。在大多數情況下,使用圖形級函式(例如relplot()或catplot())比直接使用FacetGrid更好。
基本流程是使用資料集和用於構造網格的變數初始化FacetGrid物件。然後,通過呼叫FacetGrid.map()或FacetGrid.map_dataframe(),可以將一個或多個繪圖函式應用於每個子集。最後,可以使用其他方法調整繪圖,以執行更改軸標籤,使用不同刻度或新增圖例等操作。
Parameters: | data : DataFrame
row, col, hue : strings
col_wrap : int, optional
share{x,y} : bool, ‘col’, or ‘row’ optional
height : scalar, optional
aspect : scalar, optional
palette : palette name, list, or dict, optional
{row,col,hue}_order : lists, optional
hue_kws : dictionary of param -> list of values mapping
legend_out : bool, optional
despine : boolean, optional
margin_titles : bool, optional
{x, y}lim: tuples, optional
subplot_kws : dict, optional
gridspec_kws : dict, optional
|
---|