Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes bug in tools.scatter_plot #1716

Closed
wants to merge 1 commit into from

Conversation

@theJohnnyBrown
Copy link

commented Aug 1, 2012

In [1]: import pandas

In [2]: from pandas.tools.plotting import scatter_plot

In [7]: df = pandas.DataFrame(np.random.randn(5,2), columns=['a','b'])

In [8]: df
Out[8]: 
          a         b
0  0.032454  0.057020
1 -0.292223 -0.265303
2 -0.118943  1.315302
3 -2.754867  0.827289
4  0.497206 -1.360892

In [9]: df['c'] = [True, True, False, True, False]

In [10]: df
Out[10]: 
          a         b      c
0  0.032454  0.057020   True
1 -0.292223 -0.265303   True
2 -0.118943  1.315302  False
3 -2.754867  0.827289   True
4  0.497206 -1.360892  False

In [11]: scatter_plot(df, "a", "b", by="c")
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/Users/johnnybrown/Desktop/src/pandas/pandas/<ipython-input-11-95d97e8283db> in <module>()
----> 1 scatter_plot(df, "a", "b", by="c")

/Users/johnnybrown/Desktop/src/pandas/pandas/tools/plotting.py in scatter_plot(data, x, y, by, ax, figsize, grid)
   1419 
   1420     if by is not None:
-> 1421         fig = _grouped_plot(plot_group, data, by=by, figsize=figsize, ax=ax)
   1422     else:
   1423         if ax is None:

/Users/johnnybrown/Desktop/src/pandas/pandas/tools/plotting.py in _grouped_plot(plotf, data, column, by, numeric_only, figsize, sharex, sharey, layout, rot, ax)
   1634     ravel_axes = []
   1635     for row in axes:
-> 1636         ravel_axes.extend(row)
   1637 
   1638     for i, (key, group) in enumerate(grouped):

TypeError: 'AxesSubplot' object is not iterable

@wesm

This comment has been minimized.

Copy link
Member

commented Aug 12, 2012

Thanks! you should git reset --hard pydata/master after a fetch since I cherry-picked the commit (pls try to avoid making pull requests out of your master branch)

@wesm wesm closed this Aug 12, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.