【发布时间】:2014-10-05 22:57:54
【问题描述】:
sns.FactorPlot 在尝试 set_title 时向我抛出 TypeError。这发生在示例数据框上,但更令人担忧的是,也发生在文档中的示例上。
所以
import seaborn as sns
exercise = sns.load_dataset('exercise')
sns.factorplot("kind", "pulse", "diet", exercise, kind="point")
返回一个长回溯。到此结束:
*/lib/python2.7/site-packages/seaborn/linearmodels.pyc in plot(self, ax)
275 if hasattr(self.hue, "name"):
276 leg.set_title(self.hue.name,
--> 277 prop={"size": mpl.rcParams["axes.labelsize"]})
278 ax.xaxis.grid(False)
279 ax.set_xticks(self.positions)
TypeError: set_title() got an unexpected keyword argument 'prop'
当我在启用了 pylab 内联的 iPython Notebook 中运行此程序时,该图在回溯下方显示良好。但我不明白为什么会收到此错误,尤其是文档中的示例。
【问题讨论】:
-
该代码对我来说很好,尽管我使用的是 Python 3.3/Seaborn 0.3.1。
-
我使用的是 Seaborn 0.3.1 和 Python 2.7.5。
-
在 IPython 笔记本中使用 Seaborn 0.3.1 和 Python 2.7.8 为我工作。
-
也许提供完整的回溯会有所帮助?
-
我认为这里的导入信息是您使用的 matplotlib 版本。 matplotlib 1.3.1 处理得很好。
标签: python matplotlib pandas seaborn