2016-06-21 3 views
0

Я пытаюсь нарисовать график рассеяния с гистограммами каждого измерения (сверху и справа, используя функцию JointGrid от Seaborn).Python Seaborn JointGrid IndexError

Очень простой пример:

import numpy as np 
import matplotlib.pyplot as plt 
import seaborn as sns 

x = np.random.rand(100) 
y = np.random.rand(100) 
sns.jointplot(x, y, color='r') 

Однако, я получаю следующее IndexError:

--------------------------------------------------------------------------- 
IndexError        Traceback (most recent call last) 
<ipython-input-3-42ac8946b390> in <module>() 
     1 x = np.random.rand(100) 
     2 y = np.random.rand(100) 
----> 3 sns.jointplot(x, y, color='r') 
     4 

/usr/local/lib/python2.7/site-packages/seaborn/distributions.pyc in jointplot(x, y, data, kind, stat_func, color, size, ratio, space, dropna, xlim, ylim, joint_kws, marginal_kws, annot_kws, **kwargs) 
    796  grid = JointGrid(x, y, data, dropna=dropna, 
    797      size=size, ratio=ratio, space=space, 
--> 798      xlim=xlim, ylim=ylim) 
    799 
    800  # Plot the data using the grid 

/usr/local/lib/python2.7/site-packages/seaborn/axisgrid.pyc in __init__(self, x, y, data, size, ratio, space, dropna, xlim, ylim) 
    1640   # Turn off the ticks on the density axis for the marginal plots 
    1641   plt.setp(ax_marg_x.yaxis.get_majorticklines(), visible=False) 
-> 1642   plt.setp(ax_marg_x.yaxis.get_minorticklines(), visible=False) 
    1643   plt.setp(ax_marg_y.xaxis.get_majorticklines(), visible=False) 
    1644   plt.setp(ax_marg_y.xaxis.get_minorticklines(), visible=False) 

/usr/local/lib/python2.7/site-packages/matplotlib/pyplot.pyc in setp(*args, **kwargs) 
    348 @docstring.copy(_setp) 
    349 def setp(*args, **kwargs): 
--> 350  return _setp(*args, **kwargs) 
    351 
    352 

/usr/local/lib/python2.7/site-packages/matplotlib/artist.pyc in setp(obj, *args, **kwargs) 
    1553   objs = list(cbook.flatten(obj)) 
    1554 
-> 1555  insp = ArtistInspector(objs[0]) 
    1556 
    1557  # file has to be popped before checking if kwargs is empty 

IndexError: list index out of range 

Я установил следующие версии:

NumPy 1.12.0.dev0 + cc51ba8

Matplotlib 1.5.2rc2 + 1938.g4ba20b8

Seaborn 0.7.1

Я бы очень признателен за информацию о том, что здесь происходит. Благодаря!

+0

Прекрасно работает для меня с 'numpy 1.10.4',' matplotlib 1.5.1' и 'seaborn 0.7.0'. – lanery

+0

Да, он работал и для меня, внезапно остановился, и я не понимаю, почему на основе сообщений об ошибках ... – arjology

ответ

0

Я перешел на Matplotlib 1.5.1 и теперь работает. Предположительно, некоторая ошибка в версии rc2?