本文整理汇总了Python中pylab.mpl.rcParams方法的典型用法代码示例。如果您正苦于以下问题:Python mpl.rcParams方法的具体用法?Python mpl.rcParams怎么用?Python mpl.rcParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pylab.mpl
的用法示例。
在下文中一共展示了mpl.rcParams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: violinPlot
# 需要导入模块: from pylab import mpl [as 别名]
# 或者: from pylab.mpl import rcParams [as 别名]
def violinPlot(all_data,eps):
fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(18*2, 8*2))
# plot violin plot
axes[0].violinplot(all_data,showmeans=False,showmedians=True)
axes[0].set_title('Violin plot',fontsize=30)
# plot box plot
axes[1].boxplot(all_data,flierprops={'marker':'o','markerfacecolor':'red','color':'black'})
axes[1].set_title('Box plot',fontsize=30)
# adding horizontal grid lines
for ax in axes:
ax.yaxis.grid(True)
ax.set_xticks([y + 1 for y in range(len(all_data))])
ax.set_xlabel('聚类距离',fontsize=30)
ax.set_ylabel('均衡度',fontsize=30)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
# add x-tick labels
plt.setp(axes, xticks=[y + 1 for y in range(len(all_data)) if y%2==0],xticklabels=[eps[i] for i in range(len(eps)) if i%2==0])
fig.autofmt_xdate()
plt.rcParams['font.sans-serif']=['STXihei']
plt.tick_params(labelsize=20)
plt.show()
示例2: violinPlot
# 需要导入模块: from pylab import mpl [as 别名]
# 或者: from pylab.mpl import rcParams [as 别名]
def violinPlot(all_data,estimators):
fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(8*4, 8*2))
# plot violin plot
axes[0].violinplot(all_data,showmeans=False,showmedians=True)
axes[0].set_title('Violin plot',fontsize=30)
# plot box plot
axes[1].boxplot(all_data,flierprops={'marker':'o','markerfacecolor':'red','color':'black'})
axes[1].set_title('Box plot',fontsize=30)
# adding horizontal grid lines
for ax in axes:
ax.yaxis.grid(True)
ax.set_xticks([y + 1 for y in range(len(all_data.T))])
ax.set_xlabel('回归模型',fontsize=30)
ax.set_ylabel('F1_score',fontsize=30)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
# add x-tick labels
plt.setp(axes, xticks=[y + 1 for y in range(len(all_data.T)) if y%1==0],xticklabels=[estimators[i] for i in range(len(estimators)) if i%1==0])
# plt.setp(axes)
fig.autofmt_xdate()
plt.rcParams['font.sans-serif']=['STXihei']
plt.tick_params(labelsize=20)
plt.show()
示例3: violinPlot
# 需要导入模块: from pylab import mpl [as 别名]
# 或者: from pylab.mpl import rcParams [as 别名]
def violinPlot(all_data,eps):
fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(18*2, 8*2))
# plot violin plot
axes[0].violinplot(all_data,showmeans=False,showmedians=True)
axes[0].set_title('Violin plot',fontsize=30)
# plot box plot
axes[1].boxplot(all_data,flierprops={'marker':'o','markerfacecolor':'red','color':'black'})
axes[1].set_title('Box plot',fontsize=30)
# adding horizontal grid lines
for ax in axes:
ax.yaxis.grid(True)
ax.set_xticks([y + 1 for y in range(len(all_data))])
ax.set_xlabel('聚类距离',fontsize=30)
ax.set_ylabel('聚类频数(标准化)',fontsize=30)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.tick_params(labelsize=20)
# add x-tick labels
plt.setp(axes, xticks=[y + 1 for y in range(len(all_data)) if y%2==0],xticklabels=[eps[i] for i in range(len(eps)) if i%2==0])
fig.autofmt_xdate()
# plt.tick_params(labelsize=20)
# plt.rcParams('font.sans-serif')=['STXihei'] #在开始已经设置mpl.rcParams['font.sans-serif']=['STXihei'],因此此处可忽略
plt.savefig(os.path.join(savingFig,"violinPlot"))
plt.show()