Closed janssen closed 7 years ago
And here's the same case with 1.4.3, which is clearly the only one drawn correctly, the only one with error bars:
Probably something in http://matplotlib.org/api/api_changes.html.
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:
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.
I see that image drawing was "almost completely re-written" for 2.0, which may explain the actionbar image issues.
Similarly, the outlines are no longer drawn around the bars by design.
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.
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 :(
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'
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.
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.
Here's MPL 1.5.1:
It shows the problem with polygons not being completed.
And this is with 2.0.0:
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.