Python 具有不同线条的 Relplot
Python Relplot with distinct lines
我想通过使用 relplot
为以下情节创建 Seaborn 情节:
到目前为止我的代码是:
f = sns.relplot(
data = data,
x="year",
y="gdpPercap",
hue="continent",
col="continent",
col_wrap=3,
height=2,
aspect=1.5,
alpha=0.5,
kind="line",
)
for ax in f.axes.flatten():
ax.semilogy()
然而,我的情节是这样的:
如何更改绘图以使每条线代表每个数据?
使用units
画一条单独的线,没有任何额外的语义映射:
g = sns.relplot(
data=gapminder,
kind="line",
x="year",
y="gdpPercap",
hue="continent",
col="continent",
units="country",
estimator=None,
col_wrap=3,
height=3,
alpha=0.5,
)
g.set(yscale="log")
PS 请注意,无需遍历轴即可获得对数标度的 y 轴...
我想通过使用 relplot
为以下情节创建 Seaborn 情节:
到目前为止我的代码是:
f = sns.relplot(
data = data,
x="year",
y="gdpPercap",
hue="continent",
col="continent",
col_wrap=3,
height=2,
aspect=1.5,
alpha=0.5,
kind="line",
)
for ax in f.axes.flatten():
ax.semilogy()
然而,我的情节是这样的:
如何更改绘图以使每条线代表每个数据?
使用units
画一条单独的线,没有任何额外的语义映射:
g = sns.relplot(
data=gapminder,
kind="line",
x="year",
y="gdpPercap",
hue="continent",
col="continent",
units="country",
estimator=None,
col_wrap=3,
height=3,
alpha=0.5,
)
g.set(yscale="log")
PS 请注意,无需遍历轴即可获得对数标度的 y 轴...