我正在开发我用QtDesigner创建的matplotlibwidget。
当我把我的测试点画到我的地块上时,它们大多被安排在边境线上或者穿过斧子。这在我看来不太熟悉。
所以我的问题是,我如何告诉matplotlib在图边界和测试点之间添加某种“内部填充”。例如,如果我的最小值是"500“,我想在400左右绘制左边框,所以在最小点和边框之间有一些空白。
提前谢谢你!
发布于 2014-05-12 12:28:37
plt.margins可用于调整数据周围的自动填充,如下所示。
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(10)
y = np.power(x, 3)
plt.plot(x, y, 'ro')
# Create a 5% (0.05) and 10% (0.1) padding in the
# x and y directions respectively.
plt.margins(0.05, 0.1)
plt.show()

如果您有一个最小的500值,并且希望边框在400附近,那么您可以选择0.2的x-利润率百分比,就像在plt.margins(0.2, 0.2)中那样。
https://stackoverflow.com/questions/23608843
复制相似问题