Python 更改matplotlib中的轴权重

Python 更改matplotlib中的轴权重,python,matplotlib,Python,Matplotlib,如何在matplotlib中更改轴权重(使轴更加粗体) 使用: 您可以在Matplotlib中设置称为脊椎(轴的一侧)的宽度: fig, ax = plt.subplots() ax.plot(np.random.randn(100).cumsum()) # The spines plt.setp(ax.spines.values(), linewidth=3) # The ticks ax.xaxis.set_tick_params(width=3) ax.yaxis.set_tick_

如何在matplotlib中更改轴权重(使轴更加粗体)

使用:


您可以在Matplotlib中设置称为脊椎(轴的一侧)的宽度:

fig, ax = plt.subplots()

ax.plot(np.random.randn(100).cumsum())

# The spines
plt.setp(ax.spines.values(), linewidth=3)

# The ticks
ax.xaxis.set_tick_params(width=3)
ax.yaxis.set_tick_params(width=3)

你想要像axhline(线宽=5,颜色为黑色)这样的东西吗??是的,类似于可以使所有轴更加粗体的东西@falsetru谢谢@falsetru它只改变了两个面,我想改变所有的四个面,还有记号标记不完全一样,仍然有一个边是剩余的,最右边没有与原始边合并@falsetru@tester2,对不起,我不明白你的意思。你的代码并不完美,因为它不能使所有的四个面都更粗体@falsetru@tester2,我添加了一个结果作为图像。你对四面八方都意味着什么?太好了@Rutger Kassies你能至少稍微解释一下你的代码吗
axhline(linewidth=5, color='black')
axvline(linewidth=5, color='black')
axhline(linewidth=5, y=max(y)*1.1, color='black')
axvline(linewidth=5, x=max(x)*1.1, color='black')
fig, ax = plt.subplots()

ax.plot(np.random.randn(100).cumsum())

# The spines
plt.setp(ax.spines.values(), linewidth=3)

# The ticks
ax.xaxis.set_tick_params(width=3)
ax.yaxis.set_tick_params(width=3)