Skip to content

handling of color=None by eventplot(), fixes #3728 #3729

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

Merged
merged 3 commits into from
Oct 28, 2014

Conversation

alimuldal
Copy link
Contributor

No description provided.

@tacaswell tacaswell added this to the v1.4.3 milestone Oct 27, 2014
@tacaswell
Copy link
Member

Could you please add a test to make sure this gets called? Apparently the only tests we have now explicitly pass in the color kwarg.

@alimuldal
Copy link
Contributor Author

I've tried to add a simple test case, but having never written one for matplotlib before I'm having trouble getting nose to actually run the test. I added the following lines to <source_dir>/lib/matplotlib/tests/test_axes.py:

@image_comparison(baseline_images=['test_eventplot_defaults'], remove_text=True)
def test_eventplot_defaults():
    '''
    test that eventplot produces the correct output given the default params
    (see bug #3728)
    '''
    np.random.seed(0)

    data1 = np.random.random([32, 20]).tolist()
    data2 = np.random.random([6, 20]).tolist()
    data = data1 + data2

    fig = plt.figure()
    axobj = fig.add_subplot(111)
    colls = axobj.eventplot(data)

When I try to call the test, using

<source_dir>$ python tests.py matplotlib.tests.test_axes:test_eventplot_defaults

I get the following error:

E
======================================================================
ERROR: Failure: ValueError (No such test test_eventplot_defaults)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/alistair/.venvs/matplotlib_dev/local/lib/python2.7/site-packages/nose-1.3.0-py2.7.egg/nose/failure.py", line 41, in runTest
    raise self.exc_class(self.exc_val)
ValueError: No such test test_eventplot_defaults

----------------------------------------------------------------------
Ran 1 test in 0.002s

FAILED (errors=1)

What am I missing here?

@jenshnielsen
Copy link
Member

I think that the tests runs on the installed version of the code so you should probably install it before the test is found.

@alimuldal
Copy link
Contributor Author

Thanks Jens, it turned out to be a virtualenv-related problem (I was inadvertently importing a non-modified version of matplotlib).

@@ -2187,6 +2187,23 @@ def test_eventplot():
np.testing.assert_equal(num_collections, num_datasets)


@image_comparison(baseline_images=['test_eventplot_defaults'], remove_text=True)
Copy link
Member

Choose a reason for hiding this comment

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

We probably only need the png test here. Can you add extensions=['png'] as a kwarg and then amend your last commit to drop the pdf/svg images.

@alimuldal alimuldal force-pushed the fix_eventplot_colors_arg branch from af9c108 to e754807 Compare October 28, 2014 13:28
tacaswell added a commit that referenced this pull request Oct 28, 2014
BUG : handling of color=None by eventplot(), fixes #3728
@tacaswell tacaswell merged commit 6091d11 into matplotlib:master Oct 28, 2014
@tacaswell
Copy link
Member

@alimuldal Thanks!

tacaswell added a commit that referenced this pull request Oct 28, 2014
BUG : handling of color=None by eventplot(), fixes #3728
@tacaswell
Copy link
Member

cherry-picked to 1.4.x as d684890

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

Successfully merging this pull request may close these issues.

4 participants