python - Matplotlib 在大范围内绘制非常小的 X 轴间隔?
问题描述
我的X轴数据是这样的:
X =[0.0, 0.9, 0.99, 0.999, 0.9999, 0.99999, 0.999999, 0.9999999, 0.99999999, 0.999999999, 0.9999999999, 0.99999999999, 0.999999999999, 0.9999999999999, 0.99999999999999, 1.000000000000001, 1.00000000000001, 1.0000000000001, 1.000000000001, 1.00000000001, 1.0000000001, 1.000000001, 1.00000001, 1.0000001, 1.000001, 1.00001, 1.0001, 1.001, 1.01, 1.1]
我的 Y 轴数据是这样的:
Y = [1.0, 3.16227766016838, 9.999999999999995, 31.622776601683782, 100.00000000000551, 316.22776601755754, 999.9999999856221, 3162.277661000621, 9999.999974876204, 31622.777048860404, 99999.99586298171, 316227.7529344374, 1000011.0610435781, 3161786.1272856337, 10003998.786452563, -30011996.35935769, -10003998.786452563, -3163542.1874750517, -999955.5526723525, -316227.7529344374, -99999.99586298171, -31622.77529344374, -10000.000030387355, -3162.2776592452046, -1000.0000000411333, -316.2277660158021, -100.00000000000551, -31.622776601685537, -9.999999999999995, -3.162277660168378]
我想绘制这些数据,我应该得到一个带有曲线的图表,但我得到的是:
plt.plot(X,Y)
plt.show()
#output:
但是当我使用这段代码时:
plt.plot(range(30),Y)
plt.show()
#Output:
我如何获得第二个图,但使用上面提到的列表的 X 数据?
解决方案
推荐阅读
- django - 未调用覆盖的清理函数
- python - 如何使用“matplotlib.pyplot”在不同的窗口中绘制我的图表?
- c++ - 如何在 Qt creator 4.8 中使用 C++11
- php - 将对象值替换为数组
- reactjs - 你能同时使用 React-hooks 和 redux 吗?
- c++ - 使用来自 SYSTEM 级别进程(Windows 服务)的登录用户上下文来模拟和运行任何方法:
- google-bigquery - Bigquery 命令行中的 --job_property
- excel - 缺少 Excel 库导致不需要/使用它的用户的参考错误
- java - 创建名为“serviceController”的 bean 时出错:自动装配依赖项的注入失败;
- angular - 在 2 个子组件之间传递变量会产生 ExpressionChangedAfterItHasBeenCheckedError 错误