0
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns;
tips = sns.load_dataset('tips')
tips.head()
tips['tip_pct'] = 100 * tips['tip']/tips['total_bill']
grid = sns.FacetGrid(tips, row="sex", col="time", margin_titles=True)
grid.map(plt.hist, "tip_pct", bins=np.linspace(0, 40, 15));
上記のコードをSpyder IDE(Anaconda Navigatorのパッケージ)で実行すると、目的の結果が得られます。しかし、同じコードが(行を含めます。%matplotlibのインライン)Jupter QtConsoleで実行されたときに、私は次のエラーを取得:Jupyter QtPythonエラー
アウト:
ValueErrorTraceback (most recent call last)
<ipython-input-47-c7ea1bbe0c80> in <module>()
----> 1 grid.map(plt.hist, "tip_pct", bins=np.linspace(0, 40, 15));
/Users/waqas/anaconda/lib/python3.5/site-packages/seaborn/axisgrid.py in map(self, func, *args, **kwargs)
701
702 # Get the current axis
--> 703 ax = self.facet_axis(row_i, col_j)
704
705 # Decide what color to plot with
/Users/waqas/anaconda/lib/python3.5/site-packages/seaborn/axisgrid.py in facet_axis(self, row_i, col_j)
832
833 # Get a reference to the axes object we want, and make it active
--> 834 plt.sca(ax)
835 return ax
836
/Users/waqas/anaconda/lib/python3.5/site-packages/matplotlib/pyplot.py in sca(ax)
905 m.canvas.figure.sca(ax)
906 return
--> 907 raise ValueError("Axes instance argument was not found in a figure.")
908
909
ValueError: Axes instance argument was not found in a figure.
私は何が起こっているのか分かりません。