我想要绘制在matplotlib一些数据显示的实验性功能的结果如下:Matplotlib X-标签数坐标
xvalues = [2, 4, 8, 16, 32, 64, 128, 256]
yvalues = [400139397.517, 339303459.4277, 296846508.2103, 271801897.1163,
295153640.7553, 323820220.6226, 372099806.9102, 466940449.0719]
我想这绘制在对数刻度,使其更容易可视化等方面都写了下面的代码:
import matplotlib.pyplot as plt
def plot_energy(xvalues, yvalues):
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.scatter(xvalues, yvalues)
ax.plot(xvalues, yvalues)
ax.set_xscale('log')
ax.set_xticklabels(xvalues)
ax.set_xlabel('RUU size')
ax.set_title("Energy consumption")
ax.set_ylabel('Energy per instruction (nJ)')
plt.show()
但是,你可以看到我的xlabels不会出现,因为我想他们所看到以下
如果我删除线ax.set_xticklabels(xvalues)
然后我得到了下面的结果,这不是我想无论是什么:
我是在x轴上绘制出正确的价值观一定的帮助非常感谢!
在此先感谢。