【发布时间】:2019-04-07 23:53:36
【问题描述】:
我正在尝试将平均计算值绘制为一条穿过我的数据集的每个绘制分布中心的线。
我的代码如下所示:
for plot, var in zip(range(1, plot_num+1), var_list):
ax = fig.add_subplot(2, 2, plot)
# calculate averages
sns.stripplot(x=cluster_index_sample[cluster_type], y=cluster_index_sample[var],
jitter=jitter, linewidth=line_width, alpha=alpha, cmap=RS_colorwheel,
size=marker_size, ax=ax)
# create average lines
ax.axhline(y=cluster_index_sample['Average_'+(var)].iloc[0],
linewidth=3, xmin=0.2, xmax=0.5)
ax.set_ylabel(str(var), fontsize=y_lab)
ax.set_xlabel('')
ax.tick_params(axis='both', which='major', pad=10)
但当我绘制此图时,每个 cluster_type(x 轴类别) 水平线仅出现 一次。
我怎样才能得到它,以便每组编号的分类值都有各自的平均值?
【问题讨论】:
-
不幸的是没有。
-
我应该在您提供答案时立即跟进。这是我的错——我很抱歉。
标签: python python-3.x matplotlib plot