【发布时间】:2019-01-09 23:49:25
【问题描述】:
我想用在 x 轴顶部绘制的彩色星号来标记特定的 x 轴位置。
我使用 x-tick 标签作为标记(因为我不知道是否可以在无花果坐标中的任何位置放置标记)它已正确对齐但绘制在 x 轴下方,因此它被部分覆盖.
MWE:
import numpy as np
import matplotlib.pyplot as plt
fig,ax=plt.subplots(1,1)
ax.scatter([-1,1],[1,1])
ax.set_xticks([0],minor=True)
ax.set_xticklabels(['*'],minor=True,color='r',fontsize=20,verticalalignment='center')
plt.setp(ax.spines.values(), linewidth=3)
plt.show()
这就是现在的样子:
【问题讨论】:
-
您现在的输出有什么问题?从你的问题看问题不是很清楚
-
我希望星号位于轴上方。现在,轴覆盖了符号的一部分,我希望它是相反的。不过,轴越粗越明显。
-
我现在明白了。检查我的答案,如果这是你想要的,请告诉我
标签: python matplotlib alignment