Skip to content

background color of text is forground color on MacOSX #4609

Closed

Description

@mbakker7

With MacOSX backend, the following fails:

from pylab import *
plot([1, 2, 3])
text(1, 2, 'Hello', backgroundcolor = 'red')

This plots a nice red box but no text. It looks like the backgroundcolor is set as the foreground.
mpl version 1.4.3
backend: MacOSX
Works correctly with Qt4Agg and, as reported on mailinglist, works correctly with TkAgg

Activity

  1. jenshnielsen commented on Jul 9, 2015

    @jenshnielsen
    Member

    Confirming that I see the same with the OSX backend

  2. jenshnielsen commented on Jul 9, 2015

    @jenshnielsen
    Member

    This could be related to #4024, see #4202 too

  3. efiring commented on Jul 9, 2015

    @efiring
    Member

    #4202 doesn't fix it. This looks like a different problem. Strangely, the text is very faintly visible as a slight lightening of the red. This is easier to see if you use fontsize=30. At least at the Python level, the default text color is not being overwritten by the background. I don't know what is happening inside the extension code.
    attn: @mdehoon

    In [16]: tt = text(1,2, 'hello', backgroundcolor='red', fontsize=30)
    
    In [17]: tt.get_color()
    'k'
    
  4. mdehoon commented on Jul 9, 2015

    @mdehoon
    Contributor

    I can't reproduce this bug. It's working fine for me with the MacOSX backend, matplotlib version 1.4.3.

  5. efiring commented on Jul 9, 2015

    @efiring
    Member

    @mbakker7 and @mdehoon which Python versions are you using? I tested with python 3. We have had several cases where the change between py2 and py3 in the order of iteration through a dictionary (such as kwargs in a function call) caused problems under py3.

  6. mdehoon commented on Jul 9, 2015

    @mdehoon
    Contributor

    @efiring Thanks! That is indeed the issue. With Python3, I am seeing this bug. Let me look into this.

  7. added this to the milestone on Jul 10, 2015
  8. mdehoon commented on Jul 10, 2015

    @mdehoon
    Contributor

    See pull request #4617 for a bug fix.

  9. jenshnielsen commented on Jul 11, 2015

    @jenshnielsen
    Member

    Fixed by #4617

  10. mbakker7 commented on Jul 11, 2015

    @mbakker7
    Author

    Sorry for the late reply: I have the problem with Python 2.7.9-1. Got the
    bug on two separate Macs, one with mpl 1.4.3, one with mpl 1.4.0, so it has
    been around for a little while.

    Thanks for looking into this,

    Mark

    On Thu, Jul 9, 2015 at 11:24 PM, Eric Firing notifications@github.com
    wrote:

    @mbakker7 https://github.com/mbakker7 and @mdehoon
    https://github.com/mdehoon which Python versions are you using? I
    tested with python 3. We have had several cases where the change between
    py2 and py3 in the order of iteration through a dictionary (such as kwargs
    in a function call) caused problems under py3.

    —
    Reply to this email directly or view it on GitHub
    #4609 (comment)
    .

  11. jenshnielsen commented on Jul 11, 2015

    @jenshnielsen
    Member

    @mbakker7 Thanks for the confirmation

    If you have a chance please test master and report it it fixes it for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions