我有以下数据集:
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
test_data = pd.read_csv('./data.csv',index_col = 0,header = 0)
,我想浏览我的数据。我可以使用for循环连续绘制多个散点图:
for c_type in sorted(list(set(test_data['Designation'].values))):
fil_test_data = test_data[test_data['Designation'] == c_type]
t_plt = sns.lmplot(x = 'Age',
y = 'Property_1',
hue = 'Timepoint',
data = fil_test_data)
但是,如果我切换到Seaborn的Violinplot(或类似于boxplot的分类类型图),似乎无法完成此操作
for cat_column in test_data.columns[:4]:
test_data[cat_column] = test_data[cat_column].astype('category')
for greek in sorted(list(set(test_data['Designation'].values))):
fil_test_data = test_data[test_data['Designation'] == greek]
t_plt = sns.violinplot(x = 'Group',
y = 'Property_1',
hue = 'Timepoint',
data = test_data)
ax = plt.gca()
ax.set_title('Designation {}'.format(greek))
绘制小提琴图(或分类图)不能在for循环中工作吗?