【发布时间】:2016-08-10 01:04:52
【问题描述】:
我正在尝试在具有对数 y 轴的 2D 散点图上绘制 5 个点 (x, y)。绘图已生成,但 y 轴的范围未选择好,因此仅显示一个点。当我删除第一个点 (0.38, 0.005) 后问题就消失了。
这是 matplotlib 中的错误吗?
有人可以尝试复制这个吗?
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
emissions_abs_pts = np.array([
[0.38, 0.005], # without this point it scales appropriately
[0.42, 0.05],
[0.67, 0.5],
[0.96, 5.0],
[1.0, 50.0]
])
fig, ax = plt.subplots(1, 1)
ax.scatter(emissions_abs_pts[:,0], emissions_abs_pts[:,1])
ax.set_yscale('log')
注意y轴范围是10^1到10^2
我正在使用 %matplotlib inline 和运行 Python 2.7 的 jupyter 笔记本。
【问题讨论】:
标签: python matplotlib logarithm