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

Comments

@fonnesbeck
Copy link

commented Jun 30, 2013

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

commented Jul 1, 2013

@fonnesbeck thanks. pr coming

@fonnesbeck

This comment has been minimized.

Copy link
Author

commented Jul 1, 2013

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Author

commented Jul 1, 2013

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

This comment has been minimized.

Copy link
Member

commented Jul 1, 2013

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

@fonnesbeck

This comment has been minimized.

Copy link
Author

commented Jul 1, 2013

Yes:

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

This comment has been minimized.

Copy link
Member

commented Jul 1, 2013

what the sha1?

@cpcloud

This comment has been minimized.

Copy link
Member

commented Jul 1, 2013

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

@cpcloud

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Author

commented Jul 1, 2013

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

This comment has been minimized.

Copy link
Member

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
Projects
None yet
2 participants
You can’t perform that action at this time.