2
A
回答
4
ax = gca()
ax.axhline(.5, linestyle='--')
trans = matplotlib.transforms.blended_transform_factory(
ax.transAxes,
ax.transData)
ax.annotate('label', xy=(1.01, .5), xycoords=trans, clip_on=False, va='center')
ax.set_xlim([0,2])
plt.draw()
有关混合变换的详细信息,请参阅here。 x轴的坐标是以轴为单位的(所以它总是只有一点偏离右边,y坐标就是数据单位,所以你可以把它放在你想要的地方。因为你的虚线会掩盖它们
+0
很好!我不知道你的解决方案非常简单,并且完全符合我的想法 – 2013-04-10 15:14:55
+0
@CharlesBrunet我最近才发现它们,它们很漂亮TY。 – tacaswell 2013-04-10 15:19:18
0
如果你想要一个新的比例,使用twinx()
。
fig = plt.figure()
ax = []
ax.append(fig.add_subplot(111))
ax.append(ax[0].twinx())
ax[0].plot(...)
ax[1].set_yticks([...])
ax[1].set_yticklabels([...])
plt.show()
如果你想只是一个标签,使用text
啄,作为@tcaswell写道。
相关问题
- 1. python Matplotlib在绘图右侧的Y轴刻度
- 2. matplotlib右侧的y轴标签
- 3. 在右侧添加y轴时不会显示轴标签
- 4. 重叠y轴刻度标签和x轴在matplotlib
- 5. matplotlib中的twiny()改变y轴刻度
- 6. 轴刻度标记
- 7. 如何更Y轴与不同的刻度在左侧或右侧
- 8. 将科学记数法的指数为y轴的右侧matplotlib
- 9. matplotlib中的刻度标记
- 10. 在轴的右侧/左侧/右上方添加新轴
- 11. ř图轴刻度标记
- 12. matplotlib format_major_ticks不检索轴刻度标签
- 13. Matplotlib:着色轴/刻度标签
- 14. Matplotlib添加字母刻度
- 15. Y标志在matplotlib阴谋右侧与共享x和y
- 16. 禁用Y轴刻度和标签
- 17. 重复y轴刻度标签
- 18. Matplotlib类似轴刻度
- 19. 定制Matplotlib轴刻度
- 20. matplotlib令pColor轴刻度
- 21. 动画matplotlib轴/刻度
- 22. 如何在极轴的周界线上添加刻度标记?
- 23. Matplotlib标签y轴
- 24. Y轴刻度不齐
- 25. 在侧面添加3D帮助轴matplotlib
- 26. matplotlib刻度标记的相对位置,以轴
- 27. 如何在ggplot2的图表顶部和右侧添加刻度
- 28. CorePlot:在右对齐的Y轴上定位刻度
- 29. R和ggplot-删除y轴上的“0”刻度标记
- 30. d3 - 不正确的y轴刻度标记
可能最容易的就是添加文本对象 – tacaswell 2013-04-10 14:37:57