当图形显示时,您可以通过调整坐标轴的范围来解决部分图像在框外的问题。请尝试使用以下代码来设置合适的坐标轴范围:

# 设置坐标轴的范围
ax.set_xlim([points[:, 0].min() - 0.1, points[:, 0].max() + 0.1])
ax.set_ylim([points[:, 1].min() - 0.1, points[:, 1].max() + 0.1])

这样可以在x轴和y轴的最小值和最大值上分别增加0.1的余量,确保所有的图像都在坐标轴内显示。

import matplotlibpyplot as pltimport numpy as npfrom scipyinterpolate import make_interp_spline# 假设我们有六个点的坐标points = 00 0647 01 0649 02 0677 03 0708 04 0752 05 0776 06 0794 07 0808 08 0748 09 0699 10

原文地址: https://www.cveoy.top/t/topic/iUmu 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录