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: alpha parameter was ignored when fill color is #000000 #2415

Merged
merged 1 commit into from Sep 30, 2013

Conversation

kshramt
Copy link
Contributor

@kshramt kshramt commented Sep 12, 2013

ax.scatter(xs, ys, alpha=0.1, c='k') did not produce transparent dots.

@mdboom
Copy link
Member

mdboom commented Sep 12, 2013

Would you mind including a regression test? (The current failures seem unrelated to this and are on master as well. You can ignore them until I fix master).

@pelson
Copy link
Member

pelson commented Sep 13, 2013

Looks good. I like the test image:

@@ -35,6 +35,14 @@ def test_visibility():
parser.Parse(buf) # this will raise ExpatError if the svg is invalid


@image_comparison(baseline_images=['fill_black_with_alpha'],
extensions=['svg'])
Copy link
Member

Choose a reason for hiding this comment

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

Good test. Would you mind adding "remove_text=True" here to remove the text (just to make the test image file size smaller?)

@kshramt
Copy link
Contributor Author

kshramt commented Sep 13, 2013

A new test image is:
fill_black_with_alpha.svg

@mdboom
Copy link
Member

mdboom commented Sep 13, 2013

Thanks. We're getting this test failure on Travis, Python 2.x only. (The other test failure is unrelated and can be ignored). I think the issue is the use of alpha='0.1' as a string.

======================================================================
ERROR: test suite for <class 'matplotlib.tests.test_backend_svg.test_fill_black_with_alpha'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/nose/plugins/multiprocess.py", line 788, in run
    self.setUp()
  File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/nose/plugins/multiprocess.py", line 770, in setupContext
    super(NoSharedFixtureContextSuite, self).setupContext(context)
  File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/nose/suite.py", line 314, in setupContext
    try_run(context, names)
  File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/nose/util.py", line 469, in try_run
    return func()
  File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/matplotlib-1.4.x-py2.6-linux-x86_64.egg/matplotlib/testing/decorators.py", line 105, in setup_class
    cls._func()
  File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/matplotlib-1.4.x-py2.6-linux-x86_64.egg/matplotlib/tests/test_backend_svg.py", line 43, in test_fill_black_with_alpha
    ax.scatter(x=[0, 0.1, 1], y=[0, 0, 0], c='k', alpha='0.1', s=10000)
  File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/matplotlib-1.4.x-py2.6-linux-x86_64.egg/matplotlib/axes/_axes.py", line 3280, in scatter
    collection.set_alpha(alpha)
  File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/matplotlib-1.4.x-py2.6-linux-x86_64.egg/matplotlib/collections.py", line 607, in set_alpha
    self._facecolors_original, self._alpha)
  File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/matplotlib-1.4.x-py2.6-linux-x86_64.egg/matplotlib/colors.py", line 404, in to_rgba_array
    raise ValueError("alpha must be in 0-1 range")
ValueError: alpha must be in 0-1 range

@kshramt
Copy link
Contributor Author

kshramt commented Sep 14, 2013

Tests on Travis-CI seems to have been stopped due to some error from apt-get.
Would you visit https://travis-ci.org/matplotlib/matplotlib/builds/11326417 and push a rebuild button?

E: Some index files failed to download. They have been ignored, or old ones used instead.
The command "sudo apt-get update" failed and exited with 100 during install.
Your build has been stopped.

@mdboom
Copy link
Member

mdboom commented Sep 16, 2013

Restart pushed.

@kshramt
Copy link
Contributor Author

kshramt commented Sep 17, 2013

Thanks!

@pelson
Copy link
Member

pelson commented Sep 17, 2013

@kshramt - I'm happy to merge this, but I think we should squash your commits into one. Something like:

git rebase -i HEAD~4

Details at http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html

Cheers!

mdboom added a commit that referenced this pull request Sep 30, 2013
Bug: alpha parameter was ignored when fill color is #000000
@mdboom mdboom merged commit 6a5aa01 into matplotlib:master Sep 30, 2013
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.

None yet

3 participants