Skip to content

ActionBar images look wrong (different) in matplotlib 2.0.0 #47

Closed

Description

@janssen

Here's MPL 1.5.1:

screenshot from 2017-02-01 22-43-40

It shows the problem with polygons not being completed.

And this is with 2.0.0:

screenshot from 2017-02-01 22-44-22

Much has been lost, including facecolor and text color (apparently).

Both with Kivy 1.9.1.

Clearly the facecolor is screwed up, and some lines are not being drawn.

Activity

  1. janssen commented on Feb 2, 2017

    @janssen
    ContributorAuthor

    And here's the same case with 1.4.3, which is clearly the only one drawn correctly, the only one with error bars:

    test_plt-1 4 3

  2. matham commented on Feb 2, 2017

    @matham
    Member
  3. janssen commented on Feb 2, 2017

    @janssen
    ContributorAuthor

    The 2.0.0 case is a result of a bad comparison in my code:

    _mpl_ge_2_0 = LooseVersion(matplotlib.__version__) >= LooseVersion('2.0.0rc1')
    

    I was assuming that LooseVersion knew enough about version names to properly grok that 2.0.0 was greater than 2.0.0rc1 -- but it doesn't test that way. Should be:

    _mpl_ge_2_0 = LooseVersion(matplotlib.__version__) >= LooseVersion('2.0.0')
    

    I'll submit a pull request. After that fix, we get this:

    test_plt-2 0 0-fixed

    The error bars have no caps, but that's because Matplotlib silently decided to remove them by default, substituting instead thicker lines. Note that "figure.facecolor" is still not working.

  4. janssen commented on Feb 2, 2017

    @janssen
    ContributorAuthor

    I see that image drawing was "almost completely re-written" for 2.0, which may explain the actionbar image issues.

  5. janssen commented on Feb 2, 2017

    @janssen
    ContributorAuthor

    Similarly, the outlines are no longer drawn around the bars by design.

  6. janssen commented on Feb 2, 2017

    @janssen
    ContributorAuthor

    Apparently the MPL images have been redone to have a modern 'flat' appearance, so something different should be done for the Kivy backend. Either use the old 1.4.3 images (by pulling from a subdirectory of garden.matplotlib), or doing some imaging to make them white-on-black for the actionbar. I don't think I'll tackle that.

  7. matham commented on Feb 2, 2017

    @matham
    Member

    Thanks for your research. I guess a pr for the version change should be enough for the most important stuff.

    It does make me wonder though if mpl will keep breaking things :(

  8. janssen commented on Feb 2, 2017

    @janssen
    ContributorAuthor

    And the reason there's no gray border around the plot is that 'figure.facecolor' is new since 1.4.3, and now defaults to 'w', which means "white". So, you can get the previous behavior (mostly, except for the icons) with this:

    from distutils.version import LooseVersion
    import matplotlib
    
    _mpl_ge_2_0 = LooseVersion(matplotlib.__version__) >= LooseVersion('2.0.0')
    
    if _mpl_ge_2_0:
        # restore interface changes in 2.x so that we can compare plots with 1.4.3 directly
        # 1. Lines no longer drawn around solid patches (pie chart segments, bars in bar graph)
        matplotlib.rcParams['patch.force_edgecolor'] = True
        matplotlib.rcParams['patch.facecolor'] = 'b'
        # 2. No caps on error bars
        matplotlib.rcParams['errorbar.capsize'] = 3
        # 3. Different facecolor for figure
        matplotlib.rcParams['figure.facecolor'] = 'lightgray'
    
  9. janssen commented on Feb 2, 2017

    @janssen
    ContributorAuthor

    The matplotlib crew fixed all the backends they maintain. I guess the thing to do would be to get them to take over this one.

  10. matham commented on Feb 2, 2017

    @matham
    Member

    I suppose if someone has the time and wants to champion it we may be able to get it into mpl. The code was never quite finished, in particular the docs, so it'd need someone to dedicate some time to it.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions