#13693 closed task (fixed)
Upgrade matplotlib to 1.2.1
Reported by:  jason  Owned by:  jason, was 

Priority:  major  Milestone:  sage5.10 
Component:  graphics  Keywords:  
Cc:  kcrisman, jpflori  Merged in:  sage5.10.beta0 
Authors:  Jason Grout, John Palmieri,JeanPierre Flori  Reviewers:  John Palmieri, François Bissey 
Report Upstream:  N/A  Work issues:  
Branch:  Commit:  
Dependencies:  Stopgaps: 
Description (last modified by )
Matplotlib 1.2.1 is released now: http://matplotlib.1069221.n5.nabble.com/ANNmatplotlib121releasetd40752.html
spkg: http://sage.math.washington.edu/home/jpflori/matplotlib1.2.1.spkg
apply: trac_13693part1.patch
Attachments (1)
Change History (34)
comment:1 Changed 10 years ago by
 Description modified (diff)
comment:2 Changed 10 years ago by
 Status changed from new to needs_review
comment:3 Changed 10 years ago by
comment:4 Changed 10 years ago by
 Status changed from needs_review to needs_work
Wow, sorry, that was really sloppy on my part. This is definitely needs work right now.
comment:5 Changed 10 years ago by
Those printing issues are weird. I wonder if that's from the upgrade to IPython 0.13.1?
comment:6 Changed 10 years ago by
I've uploaded a new spkg that should fix the two issues with the spkg.
comment:7 Changed 10 years ago by
I think I get the printing issues with both the old and the new IPython. See /scratch/palmieri/sage5.4.rc413693/ on sage.math for a build with a stock 5.4.rc4 plus this spkg.
comment:8 Changed 9 years ago by
I hope we can get this into Sage  version 1.2 has support for PGF/TikZ output which opens up some pretty amazing opportunities with SageTeX. (Not that I will have time to implement that in the near future, but getting this upgrade in is a necessary first step.)
comment:9 Changed 9 years ago by
See also streamplots  for #10775.
comment:10 Changed 9 years ago by
Definitely would be nice. I had seen the failures before in sageongentoo before forcing 1.1.0. I will see if I can dedicate some time to it this week.
comment:11 Changed 9 years ago by
Regarding the failures: I can easily fix all of them except the ones in plot.py:
sage: q1 = plot([sin(x), tan(x)], legend_label='trig') sage: len(q1.matplotlib().axes[0].legend().texts) # used to raise AttributeError 1 :: Make sure that we don't get multiple legend labels for plot segments (:trac:`11998`):: sage: p1 = plot(1/(x^21),(x,2,2),legend_label="foo",detect_poles=True) sage: len(p1.matplotlib().axes[0].legend().texts) 1
For the first one (q1
), with the new spkg there are two legend labels ("trig" and "None"), where there used to be just one. For p1
, there are now three labels, in direct contradiction of the text. It looks like the picture at #11998, except the labels are "None", "None", and "foo". I don't know how to fix these. See my patch for the other fixes.
comment:12 Changed 9 years ago by
 Description modified (diff)
comment:13 Changed 9 years ago by
 Description modified (diff)
comment:14 Changed 9 years ago by
 Cc jpflori added
 Summary changed from Upgrade matplotlib to 1.2.0 to Upgrade matplotlib to 1.2.1
I was just doing the same thing this evening to try random Cygwin stuff.
I guess we should look for 1.2.1.
comment:15 Changed 9 years ago by
 Description modified (diff)
Updated spkg at: http://boxen.math.washington.edu/home/jpflori/matplotlib1.2.1.spkg
comment:16 followup: ↓ 17 Changed 9 years ago by
 Status changed from needs_work to needs_review
Not sure if it's the update wihch changed something but I have no failures in plot.py on my 5.9.beta1 install.
I'm putting this back to needs_review though I could not run "make ptestlong" yet cause the install I have access to is kind of borken because of ATLAS black magic.
comment:17 in reply to: ↑ 16 Changed 9 years ago by
Replying to jpflori:
Not sure if it's the update wihch changed something but I have no failures in plot.py on my 5.9.beta1 install.
Same for me, too. I'll try make ptestlong
on a few machines to see what happens.
comment:18 Changed 9 years ago by
Has anyone manually checked the images connected to the failing doctests from before, just to make sure we're not missing a problem?
comment:19 Changed 9 years ago by
I had a look at the q1 one to spot the problem but it looked fine (blue sine and other curve, axes, little box with a blue segment and trig, no None anywhere) and was confused and then indeed there was no failing doctest.
comment:20 Changed 9 years ago by
I also looked at the examples by hand, and they looked fine (as opposed to with the 1.2.0 spkg). make ptestlong
passed on two platforms: boxen.math.washington.edu and an OS X 10.8.3 machine.
So I'm happy with the spkg. If people are happy with my patch, can we give this a positive review?
comment:21 Changed 9 years ago by
I think the patch is all fine. I had to check if it was the intended behavior for plot_field3d.py (monochrome 3d field, I guess it can be useful sometimes).
comment:22 Changed 9 years ago by
 Reviewers set to John Palmieri, Francois Bissey
 Status changed from needs_review to positive_review
comment:23 Changed 9 years ago by
 Description modified (diff)
 Milestone changed from sage5.9 to sage5.10
comment:24 Changed 9 years ago by
 Description modified (diff)
I'm assuming the patch should be applied...
comment:25 Changed 9 years ago by
Yes I should have done the clean up of the description.
comment:26 Changed 9 years ago by
This is very wrong and should be fixed:
assert(cm is not None) except (TypeError, AssertionError, ValueError):
AssertionError
should never be handled in an exception block, unless you have very good reasons to do so. The obvious solution is replacing assert()
by something else.
I know this problem isn't caused by this patch, but since it is easy to fix, you should fix it.
comment:27 Changed 9 years ago by
For example, you could do:
try: cm = get_cmap(colors) except (TypeError, ValueError): cm = None if cm is None: ...
comment:28 Changed 9 years ago by
 Status changed from positive_review to needs_work
comment:29 Changed 9 years ago by
 Status changed from needs_work to needs_review
Okay, here's a new version of the patch. The only change is this:

sage/plot/plot3d/plot_field3d.py
diff git a/sage/plot/plot3d/plot_field3d.py b/sage/plot/plot3d/plot_field3d.py
a b 72 72 try: 73 73 from matplotlib.cm import get_cmap 74 74 cm = get_cmap(colors) 75 assert(cm is not None) 76 except (TypeError, AssertionError, ValueError): 75 except (TypeError, ValueError): 76 cm = None 77 if cm is None: 77 78 if isinstance(colors, (list, tuple)): 78 79 from matplotlib.colors import LinearSegmentedColormap 79 80 cm = LinearSegmentedColormap.from_list('mymap',colors)
comment:30 Changed 9 years ago by
 Status changed from needs_review to positive_review
I'm going to restore the positive review, also; you can view my change as a positive review of Jeroen's suggestion...
comment:31 Changed 9 years ago by
 Merged in set to sage5.10.beta0
 Resolution set to fixed
 Status changed from positive_review to closed
comment:32 Changed 9 years ago by
As a followup: the new version of matplotlib seems to be causing an issue with saving graphs in pdf. See:
https://groups.google.com/forum/?fromgroups=#!topic/sagedevel/6l9Z4y5rCuM
comment:33 Changed 9 years ago by
 Reviewers changed from John Palmieri, Francois Bissey to John Palmieri, François Bissey
I'm trying this out. A few quick comments:
=== matplotlib1.1.0 (Jason Grout, 09 Nov 2012) ===
should say1.2.0
.patches/mkdirracecondition.patch
should be removed from the repository (according tohg status
, the repo is not clean right now).ValueError: Colormap red is not recognized
. I don't know what to do about this one. I haven't run full doctests, just on the plot directory. I'll let you know if I find anything else.