seaborn.objects.Plot.pair#
- Plot.pair(x=None, y=None, wrap=None, cross=True)#
複数の `x` または `y` 変数をペアリングしてサブプロットを作成します。
- パラメータ:
- x, yデータベクトルまたは識別子のシーケンス
サブプロットのグリッドを定義する変数。
- wrap整数
`x` または `y` のみを使用する場合、この数の列(`x` を使用する場合)または行(`y` を使用する場合)を持つ二次元グリッドにサブプロットを「折り返し」ます。
- crossブール値
False の場合、`x` と `y` のリストを zip 圧縮し、最初のサブプロットが最初のペア、2 番目のサブプロットが 2 番目のペアを取得するようにします。それ以外の場合は、リストのデカルト積から二次元グリッドを作成します。
例
`y` を割り当て、`x` でペアリングすることにより、1 つの従属変数を複数の独立変数に対してプロットします。
( so.Plot(mpg, y="acceleration") .pair(x=["displacement", "weight"]) .add(so.Dots()) )
`x` と `y` の両方にリストを渡すことで、複数のペアワイズ関係を表示します
( so.Plot(mpg) .pair(x=["displacement", "weight"], y=["horsepower", "acceleration"]) .add(so.Dots()) )
`x` と `y` の両方にリストを提供する場合、すべてのペアワイズ関係を表示するのではなく、リスト内の各位置をペアリングするには、`cross=False` を渡します
( so.Plot(mpg) .pair( x=["weight", "acceleration"], y=["displacement", "horsepower"], cross=False, ) .add(so.Dots()) )
複数の `x` または `y` 変数に対してプロットする場合、サブプロットを `wrap` して二次元グリッドを作成することができます
( so.Plot(mpg, y="mpg") .pair(x=["displacement", "weight", "horsepower", "cylinders"], wrap=2) .add(so.Dots()) )
ペアリングはファセットと組み合わせることができ、`y` でペアリングして `col` でファセットするか、`x` でペアリングして `row` でファセットします
( so.Plot(mpg, x="weight") .pair(y=["horsepower", "acceleration"]) .facet(col="origin") .add(so.Dots()) )
通常はペアリング変数を共通の `data` への参照として割り当てるのが便利ですが、ベクトルのリストを渡すことも可能です
( so.Plot(mpg["weight"]) .pair(y=[mpg["horsepower"], mpg["acceleration"]]) .add(so.Dots()) )
Plot.label()
、Plot.limit()
、Plot.scale()
などのメソッドでプロットをカスタマイズする場合、個々の座標変数を `x0`、`x1` などとして参照できます。( so.Plot(mpg, y="mpg") .pair(x=["weight", "displacement"]) .label(x0="Weight (lb)", x1="Displacement (cu in)", y="MPG") .add(so.Dots()) )