在轴上绘制标记 [英] plotting markers on top of axes
问题描述
我打算使用 numpy.js 制作 (x,y) 散点图.现在,轴从(0,0)开始并延伸以与数据范围对齐.我需要绘制x = 0线上的两个点.
I am tying to make a (x,y) scatter plot using numpy. Right now the axes start from (0,0) and extend to align with the range of the data. I need to plot two points which lie on the x=0 line.
当前看来,符号在轴之前被绘制,随后被轴截断.我希望它出现在轴的顶部.我相信我可以用标签"做某事,但是我找不到任何方法可以使它工作.
Currently it appears the symbols are being drawn before the axes, and subsequently are being truncated by the axes. I would like this to appear on top of the axes. I believe I can do something with a 'label' however I cannot find any method to make this work.
标记在某种程度上可见,但是它们是可视化的重要组成部分.如果有人在周围工作,那就太好了.
The markers are somewhat visible, however they are a decently crucial component of the visualization. If someone has a work around this would be wonderful.
推荐答案
可以关闭plt.plot创建的线对象的剪辑标志.
You can turn off the clip flag of the line object created by plt.plot.
import numpy as np
import matplotlib.pyplot as plt
x = np.array([0,1,2,3,4,5,6])
y = np.array([0,2,0,4.5,0.5,2,3])
line = plt.plot(x,y,'o')[0]
line.set_clip_on(False)
plt.show()
这篇关于在轴上绘制标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!