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

DataFrame.hist does not honor sharex or sharey set to True #4089

Closed
fonnesbeck opened this issue Jun 30, 2013 · 13 comments · Fixed by #4091
Closed

DataFrame.hist does not honor sharex or sharey set to True #4089

fonnesbeck opened this issue Jun 30, 2013 · 13 comments · Fixed by #4091
Labels
Milestone

Comments

@fonnesbeck
Copy link

Here is an example of the hist method called as a multi-panel plot via the by argument, with sharey=True and sharex=True. As you can observe in the plot at the bottom of the notebook, neither the x nor the y axis is shared among the subplots.

Running 0.11.1 on Python 2.7.2 (OS X 10.8.4).

@cpcloud
Copy link
Member

cpcloud commented Jul 1, 2013

so the issue is that using by doesn't pass the share* params. i'll see what i can do

@cpcloud
Copy link
Member

cpcloud commented Jul 1, 2013

@fonnesbeck thanks. pr coming

@fonnesbeck
Copy link
Author

Sorry I did not get a chance to look at this last night. Unfortunately, though the update does cause the axes to be shared among the subplots, it seems to have introduced another bug: The histogram no longer appears in the plots. Here is the updated notebook. I have added additional plots showing that the histograms work with no sharing. When you use sharex only, nothing appears; when you use sharey only it creates incorrect y-axis limits altogether.

@cpcloud
Copy link
Member

cpcloud commented Jul 1, 2013

one issue is that the first axes is shared, so some of your data won't show up since it is outside of the range of those axes. however, there's an oddity there: why is it using those particular xaxis limits

@cpcloud
Copy link
Member

cpcloud commented Jul 1, 2013

can you confirm that this works with the data generated in pandas/tests/test_graphics.py:TestDataFrameGroupBypPlots.test_shared_axis?

@fonnesbeck
Copy link
Author

It fails at test_time_series_plot_color_with_empty_kwargs:

nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']
nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']
nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']
test_axis_shared (__main__.TestDataFrameGroupByPlots) ... ok
test_boxplot (__main__.TestDataFrameGroupByPlots) ... ok
test_grouped_hist (__main__.TestDataFrameGroupByPlots) ... ok
test_invalid_colormap (__main__.TestDataFrameGroupByPlots) ... ok
test_option_mpl_style (__main__.TestDataFrameGroupByPlots) ... ok
test_series_plot_color_kwargs (__main__.TestDataFrameGroupByPlots) ... ok
test_time_series_plot_color_kwargs (__main__.TestDataFrameGroupByPlots) ... ok
test_time_series_plot_color_with_empty_kwargs (__main__.TestDataFrameGroupByPlots) ... > /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py(420)assertTrue()
-> raise self.failureException(msg)
(Pdb) c
FAIL

======================================================================
FAIL: test_time_series_plot_color_with_empty_kwargs (__main__.TestDataFrameGroupByPlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/fonnescj/Code/pandas/pandas/tests/test_graphics.py", line 912, in test_time_series_plot_color_with_empty_kwargs
    self.assert_(line_colors == ['b', 'g', 'r'])
AssertionError: False is not true

----------------------------------------------------------------------
Ran 8 tests in 24.977s

FAILED (failures=1)

@cpcloud
Copy link
Member

cpcloud commented Jul 1, 2013

is this from master? i fixed that a few commits ago. that had to with not closing plots

@fonnesbeck
Copy link
Author

Yes:

~/Code/pandas/.git(branch:master) » more HEAD                   fonnescj@Cepeda
ref: refs/heads/master

@cpcloud
Copy link
Member

cpcloud commented Jul 1, 2013

what the sha1?

@cpcloud
Copy link
Member

cpcloud commented Jul 1, 2013

nvm i c that u have the latest since my test i there

@cpcloud
Copy link
Member

cpcloud commented Jul 1, 2013

did u run with nosetests? if not can u try that? it looks like u ran the file as an executable with python. if that's not the issue then i can reopen, as it seems like it might be mac specific

@fonnesbeck
Copy link
Author

I get the following failures:

~/Code/pandas(branch:master*) » nosetests pandas/tests/test_graphics.py
.......F...F........................................
======================================================================
FAIL: test_time_series_plot_color_with_empty_kwargs (pandas.tests.test_graphics.TestDataFrameGroupByPlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/fonnescj/Code/pandas/pandas/tests/test_graphics.py", line 912, in test_time_series_plot_color_with_empty_kwargs
    self.assert_(line_colors == ['b', 'g', 'r'])
AssertionError: False is not true

======================================================================
FAIL: test_bar_log (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/fonnescj/Code/pandas/pandas/tests/test_graphics.py", line 504, in test_bar_log
    self.assertEqual(ax.yaxis.get_ticklocs()[0], 1.0)
AssertionError: 0.10000000000000001 != 1.0

----------------------------------------------------------------------
Ran 52 tests in 101.801s

FAILED (failures=2)

@cpcloud
Copy link
Member

cpcloud commented Jul 1, 2013

Strange. The second one should be calling assert almost equal maybe with a precision argument . I thought that was fixed by a previous commit. The first one I'm not sure but I ll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants