更改具有相同标签的所有子图中 x/yticks 的字体大小
我正在尝试使每个子图的X/yticks的字体大小更大。我已经尝试使用
ax.set_xticklabels(xlabels,fontsize =)
,
但我不想指定新标签。我想要在图上默认的相同的(请参见下图)。总共有3个子图,我想增加所有子图的大小。
代码的一部分
markers = ['s','^','d','*','o']
colors = ['crimson', 'blueviolet', 'limegreen', 'mediumblue', 'hotpink']
fig,ax = plt.subplots(2, 2, dpi=300, figsize=(30, 25))
fig.delaxes(ax[1,1])
fig.tight_layout()
plt.rcParams['axes.grid'] = True
#plt.xticks(fontsize=24)
x=data['CPR']
y=data['DLP']
for xp, yp, m, c, t in zip(x,y,markers, colors, targets):
ax[0,0].scatter(xp,yp,s=150,marker=m, color=c, label=t, zorder=1)
ax[0,0].errorbar(data['CPR'],data['DLP'],xerr=data['CPR_stddev'],yerr=data['DLP_stddev'],
ls='none',
ecolor='slategray',
elinewidth=1,
barsabove=False)
ax[0,0].grid(color='gray', linestyle='--', linewidth=0.5)
ax[0,0].set_title('CPR vs DLP',fontsize='40')
handles, labels = ax[0,0].get_legend_handles_labels()
fig.legend(handles, labels, scatterpoints=1, borderpad=0.2, loc='upper left', fontsize=24)
ax[0,0].set_xlabel('CPR',fontsize=30)
ax[0,0].set_ylabel('DLP',fontsize=30)
ax[0,0].set_xlim([0,1.2])
####ax[0,0].set_xticks(fontsize=24)
plt.xticks(fontsize=24)
#plt.show()
***研究海报 - 任何其他建议。
I'm trying to make the font size of the x/yticks of each subplot larger. I've tried using
ax.set_xticklabels(xlabels, Fontsize= )
but I don't want to specify new labels. I want the same ones that were defaulted on the plot (see image below). There are 3 total subplots and I'd like to increase the tick size of all of them.
Part of Code
markers = ['s','^','d','*','o']
colors = ['crimson', 'blueviolet', 'limegreen', 'mediumblue', 'hotpink']
fig,ax = plt.subplots(2, 2, dpi=300, figsize=(30, 25))
fig.delaxes(ax[1,1])
fig.tight_layout()
plt.rcParams['axes.grid'] = True
#plt.xticks(fontsize=24)
x=data['CPR']
y=data['DLP']
for xp, yp, m, c, t in zip(x,y,markers, colors, targets):
ax[0,0].scatter(xp,yp,s=150,marker=m, color=c, label=t, zorder=1)
ax[0,0].errorbar(data['CPR'],data['DLP'],xerr=data['CPR_stddev'],yerr=data['DLP_stddev'],
ls='none',
ecolor='slategray',
elinewidth=1,
barsabove=False)
ax[0,0].grid(color='gray', linestyle='--', linewidth=0.5)
ax[0,0].set_title('CPR vs DLP',fontsize='40')
handles, labels = ax[0,0].get_legend_handles_labels()
fig.legend(handles, labels, scatterpoints=1, borderpad=0.2, loc='upper left', fontsize=24)
ax[0,0].set_xlabel('CPR',fontsize=30)
ax[0,0].set_ylabel('DLP',fontsize=30)
ax[0,0].set_xlim([0,1.2])
####ax[0,0].set_xticks(fontsize=24)
plt.xticks(fontsize=24)
#plt.show()
***This is for a research poster -- any other recommendations welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试以下操作:
Try this: