【问题标题】:How to add axes numbers to matplotlib plot?如何将轴号添加到 matplotlib 图?
【发布时间】:2019-02-06 22:22:21
【问题描述】:

如果我在下面有这个图,如何在 (0,0) 旁边添加坐标 (29.05,-93.68)?所以我想包括坐标(0,0)和左下角。我试过了:

import matplotlib.axes as axes
axes.Axes.set_xlim(left=-93.86,right=None)
axes.Axes.set_ylim(bottom=-29.05,top=None)

但我不断收到错误消息。我也不认为这是包含这两点的正确方法。有什么建议么?

【问题讨论】:

  • 首先,minimal reproducible example 有助于了解您在做什么。然后我不明白“包括一个点”在结果图中是什么意思。在我“包含一个点”的地方,情节会如何?关于错误,这肯定是因为您应该调用您绘制到的轴 instance.set_xlim 方法,即您的代码中可能有某个位置的 ax

标签: python matplotlib plot


【解决方案1】:

试试这个:

import matplotlib.pyplot as as plt
fig, ax = plt.subplots()    
ax.set_xlim(-93.86, 22.5)
ax.set_ylim(-29.05, 20)

【讨论】:

    猜你喜欢
    • 2016-11-29
    • 2020-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多