matplotlib散点图:太多Xticks/yticks

发布于 2025-01-24 19:41:54 字数 515 浏览 2 评论 0原文

因此,使用matplotlib散点图,我得到了一个看起来像这样的情节: 散点图

我试图绘制一长串坐标列表x和y轴标记每个点的标签,以无序的方式。我只想设置X和Y轴标签,例如(10,20,...,100),而不是每个点出现。

def visualise(self):
    input_file = open("textFiles/points.txt", 'r')
    xVals = []
    yVals = []
    for line in input_file:
        line = line.split(",")
        xVals.append(line[0])
        yVals.append(line[1])

    plt.scatter(xVals,yVals, s = 2)
    plt.show()

So using matplotlib scatter plot, i am getting a plot that looks like this:
scatter plot

I am trying to plot a long list of coordinates however it appears to be making a seperate x and y axis label for every single point in an unordered manner. I just want to to have set x and y axis labels e.g. (10,20,...,100) instead of one appearing for every point.

def visualise(self):
    input_file = open("textFiles/points.txt", 'r')
    xVals = []
    yVals = []
    for line in input_file:
        line = line.split(",")
        xVals.append(line[0])
        yVals.append(line[1])

    plt.scatter(xVals,yVals, s = 2)
    plt.show()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文