以下python3代码不会在9号线工作,因为双断行的,:双断行失败,matplotlib和XKCD风格
# -*- coding: utf-8 -*-
from matplotlib import pyplot as plt
import numpy as np
plt.xkcd()
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
plt.text(4, 400, '-> 1 Pig ~ 150 kg\n\n-> Butching => 80 to 100 kg meat')
plt.axis([0, 7, 0, 2000])
plt.plot([0,1,2,3,4,5], [0,400,800,1200,1600, 2000])
ax.set_ylim([0, 2000])
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
plt.show()
但如果我删除plt.xkcd()
线,然后一切工作正常,即使与双重线决裂。 现在有人为什么? 这是一个错误还是有任何解决方法?
我的设置: Windows 7的AMD64, 蟒蛇3.3, numpy的1.8, matplotlib 1.3.1
和它与plt.xkcd线工作,如果去掉双断行?你确定这是因为双重换行吗?因为我的matplotlib版本太低n的错误重现在plt.xkcd()提供错误 - – usethedeathstar
@mutzmatron我修正了他的代码,错误报告正确...我在这里转载 –
我打开了这个问题在matplotlib的问题跟踪器在GitHub上...](https://github.com/matplotlib/matplotlib/issues/2687) –