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

BUG: Fixed plot label shows as None. #8905 #8945

Closed
wants to merge 1 commit into from

Conversation

dxe4
Copy link
Contributor

@dxe4 dxe4 commented Nov 30, 2014

Fixes #8905

low.plot(legend=True)
ax = high.plot(legend=True)
low.plot(legend=True, label='label')
ax = high.plot(legend=True, label='label')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this, but the legend in this case did show up as 'None'

@jorisvandenbossche jorisvandenbossche added this to the 0.15.2 milestone Nov 30, 2014
@jorisvandenbossche
Copy link
Member

@TomAugspurger another plotting one

@jreback
Copy link
Contributor

jreback commented Nov 30, 2014

@papaloizouc pls add a release not in v0.15.2 as well (in bug fix section)

@dxe4
Copy link
Contributor Author

dxe4 commented Nov 30, 2014

May need some help on this one. test_graphics.TestDataFramePlots.test_boxplot expects a warning No labelled objects found. Use label='...' kwarg on individual plots. When i run the test or the test case individually it passes. But when i run all tests it fails. I am a bit lost. Might be because of

if __name__ == '__main__':
    nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
                   exit=False)
nosetests pandas/tests/test_graphics.py:TestDataFramePlots.test_boxplot
Ran 1 test in 1.981s
OK
 nosetests pandas/tests/test_graphics.py:TestDataFramePlots
Ran 82 tests in 94.078s
OK (SKIP=5)
 nosetests
FAIL: test_boxplot (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/foobar/dev/pandas/pandas/tests/test_graphics.py", line 1839, in test_boxplot
    subplots=True, logy=True)
  File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/home/foobar/dev/pandas/pandas/util/testing.py", line 1674, in assert_produces_warning
    % expected_warning.__name__)
AssertionError: Did not see expected warning of class 'UserWarning'.

@dxe4
Copy link
Contributor Author

dxe4 commented Nov 30, 2014

@jreback sorry forgot to add it in the tag will keep in mind on the next one

@TomAugspurger
Copy link
Contributor

I'll try to look soon. @papaloizouc does the warning occur when you run this from the interpreter?

@dxe4
Copy link
Contributor Author

dxe4 commented Dec 2, 2014

@TomAugspurger yeah i was closer on this yesterday i think i can fix this soon but i still didn't figure out what is wrong with the tests. i removed the if __main__ but still the tests pass unless i run all of them. If you want i can make a different ticket for the tests.

@TomAugspurger
Copy link
Contributor

Great. I'll checkout your branch and see if I can figure out the warning test tonight or tomorrow.

@jreback jreback added the Bug label Dec 3, 2014
@@ -99,6 +99,7 @@ Bug Fixes
- Bug in ``BlockManager`` where setting values with different type would break block integrity (:issue:`8850`)
- Bug in ``DatetimeIndex`` when using ``time`` object as key (:issue:`8667`)
- Fix negative step support for label-based slices (:issue:`8753`)
- Fixed given label showing as None (:issue:`#8905`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

say this is in plotting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure will do, will try to figure out the test warning today

@jreback
Copy link
Contributor

jreback commented Dec 6, 2014

@TomAugspurger ?

@jreback
Copy link
Contributor

jreback commented Dec 6, 2014

@papaloizouc can you rebase on master and push again (the build failure should be fixed I think)

@dxe4
Copy link
Contributor Author

dxe4 commented Dec 6, 2014

@jreback i did rebase still failing but when i try it in ipython it looks like the warning shows only the first time i generate the plot. For the first time i can see the same warning in master and my branch. I am not exactly sure what went wrong tho because the test was not failing before.

The code i use is:

import pandas as pd
import matplotlib.pyplot as plt
import pandas.io.data as web
import matplotlib as mpl
import pandas.util.testing as tm
import numpy as np
import pandas.core.common as com


n = 100
gender = tm.choice(['Male', 'Female'], size=n)
classroom = tm.choice(['A', 'B', 'C'], size=n)

hist_df = pd.DataFrame({'gender': gender,
                          'classroom': classroom,
                           'height': random.normal(66, 4, size=n),
                           'weight': random.normal(161, 32, size=n),
                           'category': random.randint(4, size=n)})

df = hist_df
series = df['height']
numeric_cols = df._get_numeric_data().columns
labels = [com.pprint_thing(c) for c in numeric_cols]
df.plot(kind='box', subplots=True, logy=True)

And i get

/home/foobar/dev/venvs/pandas_venv/local/lib/python2.7/site-packages/matplotlib/axes/_axes.py:476: UserWarning: No labelled objects found. Use label='...' kwarg on individual plots.
  warnings.warn("No labelled objects found. "

@jreback
Copy link
Contributor

jreback commented Dec 6, 2014

warnings only show once (for a test)

@jreback
Copy link
Contributor

jreback commented Dec 8, 2014

@TomAugspurger @jorisvandenbossche pls merge or bump asap (obviously needs fixing though)

@dxe4
Copy link
Contributor Author

dxe4 commented Dec 8, 2014

sorry guys i couldn't figure out what went wrong with tests, i get the warning running the single test and running in ipython. spent a lot of time on this but couldn't figure it out.

@jreback jreback modified the milestones: 0.16.0, 0.15.2 Dec 10, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 3, 2015
@jorisvandenbossche
Copy link
Member

It seems that this has been fixed in the meantime by #9574, so closing this

@jorisvandenbossche jorisvandenbossche modified the milestones: 0.16.1, Next Major Release, No action May 1, 2015
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 this pull request may close these issues.

Plot label None in line plot
4 participants