列名中的季节性线条样式

问题描述 投票:0回答:1

我有数据框:

      Blau_Loch  Blau_Scheibe  Rot_Loch  Rot_Scheibe
0        0.4190        0.4120     0.420       0.4110
1        0.4180        0.4130     0.421       0.4170
2        0.4200        0.4150     0.421       0.4140
3        0.4180        0.4100     0.422       0.4140
4        0.4190        0.4130     0.421       0.4130

如何在style中设置seaborn.relplot()参数,以使每列的图具有不同的样式。

python seaborn
1个回答
0
投票

您没有写很多有关如何调用函数的细节。您可以使用relplot将颜色设置为palette=,并使用markers=设置标记。我不确定如何以这种方式形成空心圆;标记可以从this page中选择。

这里是一个例子:

import matplotlib.pyplot as plt
import pandas as pd
import seaborn

df = pd.DataFrame(columns=['Blau_Loch', 'Blau_Scheibe', 'Rot_Loch', 'Rot_Scheibe'],
                  data=[[0.4190, 0.4120, 0.420, 0.4110],
                        [0.4180, 0.4130, 0.421, 0.4170],
                        [0.4200, 0.4150, 0.421, 0.4140],
                        [0.4180, 0.4100, 0.422, 0.4140],
                        [0.4190, 0.4130, 0.421, 0.4130]])
seaborn.relplot(data=df, markers=['X', 'o', 'X', 'o'], palette=['steelblue', 'dodgerblue', 'crimson', 'tomato'])

plt.show()

resulting plot

© www.soinside.com 2019 - 2024. All rights reserved.