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

Remove numpy warnings in slope field #11208

Closed
kcrisman opened this issue Apr 17, 2011 · 20 comments
Closed

Remove numpy warnings in slope field #11208

kcrisman opened this issue Apr 17, 2011 · 20 comments

Comments

@kcrisman
Copy link
Member

Having no arrows in an arrow plot (i.e., vector field that is a slope field) now causes warnings from matplotlib.

y = var('y') 
g = 1 
P=plot_slope_field(g,(x,3,4),(y,-1,1)) 
P 
<two sets of warnings> 

DSM has a diagnosis at this sage-support thread

P=plot_slope_field(g,(x,3,4),(y,-1,1),headlength=1e-8) 
works for me.  FYI, it's the following few lines in Quiver._h_arrows at fault: 
        minsh = self.minshaft * self.headlength 
        [....] 
        shrink = length/minsh 
        X0 = shrink * X0[np.newaxis,:] 
        Y0 = shrink * Y0[np.newaxis,:] 
Probably we should change the defaults and/or (if it's not done 
already) ask our matplotlib friends to special-case 0 for no 
arrowheads.

So maybe this should be reported upstream? See also #2922, which is also about the mpl quivers.

Depends on #10489

Upstream: Reported upstream. Little or no feedback.

CC: @jasongrout @novoselt

Component: graphics

Author: Douglas McNeil

Reviewer: David Loeffler, Karl-Dieter Crisman

Merged: sage-5.0.beta9

Issue created by migration from https://trac.sagemath.org/ticket/11208

@jasongrout
Copy link
Member

Upstream: Not yet reported upstream; Will do shortly.

@jasongrout
Copy link
Member

comment:1

This should be reported upstream, right?

@jasongrout jasongrout added this to the sage-4.7 milestone Apr 17, 2011
@kcrisman
Copy link
Member Author

comment:2

Probably, and I say so on sage-support, but I don't know how to make this pure matplotlib, and maybe they would say it's user error? But you are almost certainly right.

@kcrisman
Copy link
Member Author

comment:3

I don't think this was ever reported upstream. And now it's going to cause a problem for our PREP calculus tutorial... grumble, grumble.

@sagetrac-mhampton
Copy link
Mannequin

sagetrac-mhampton mannequin commented Sep 8, 2011

comment:4

For the moment it seems OK to use Doug McNeil's hack of setting: headlength=1e-8
Its better than leaving this problem around any longer in my opinion.

@sagetrac-dsm
Copy link
Mannequin

sagetrac-dsm mannequin commented Feb 27, 2012

comment:6

Patch attached. Wasn't sure of the idiom for doctesting the warnings; went with what I would have done in a non-Sage project.

@sagetrac-dsm sagetrac-dsm mannequin added the s: needs review label Feb 27, 2012
@sagetrac-dsm
Copy link
Mannequin

sagetrac-dsm mannequin commented Feb 27, 2012

headlength = epsilon hack

@loefflerd
Copy link
Mannequin

loefflerd mannequin commented Mar 11, 2012

Dependencies: #10489

@loefflerd
Copy link
Mannequin

loefflerd mannequin commented Mar 11, 2012

Reviewer: PatchBot

@loefflerd
Copy link
Mannequin

loefflerd mannequin commented Mar 11, 2012

comment:7

Attachment: trac_11208_avoid_headless_quiver_warning.patch.gz

This doesn't apply to the current Sage dev version -- it seems to conflict with #10489. Can you rebase it?

@loefflerd loefflerd mannequin added s: needs work and removed s: needs review labels Mar 11, 2012
@sagetrac-dsm
Copy link
Mannequin

sagetrac-dsm mannequin commented Mar 11, 2012

Changed upstream from Not yet reported upstream; Will do shortly. to Reported upstream. Little or no feedback.

@kcrisman
Copy link
Member Author

Changed reviewer from PatchBot to David Loeffler, Karl-Dieter Crisman

@kcrisman
Copy link
Member Author

comment:9

On the plus side, it works! DSM, just be sure to not replace the previous patch so that we can compare the two, but the rebase should be nearly trivial (I almost did it just now, but decided you were probably in the midst). The only thing I could possibly say is that I would put the "(trac #11208)::" on the next line, but it's not really that important.

So positive review, modulo rebase.

@kcrisman
Copy link
Member Author

Author: Douglas McNeil

@sagetrac-dsm
Copy link
Mannequin

sagetrac-dsm mannequin commented Mar 12, 2012

headlength = epsilon hack, rebased to 5.0.beta7

@sagetrac-dsm
Copy link
Mannequin

sagetrac-dsm mannequin commented Mar 12, 2012

comment:10

Attachment: trac_11208_avoid_headless_quiver_warning_v2.patch.gz

Dropped a message on matplotlib-devel; at least one dev thought special-casing zero was a good idea, so I'll work up a matplotlib patch if I get some time. Not much pressure to do it on our end now, though. [PS @kcrisman -- not only was I in the midst, I was typing things like 'hg export tip' as you were writing that..]

@kcrisman
Copy link
Member Author

comment:11

Great, make sure to post a link to the discussion on matplotlib-devel. This applies to beta7 and fixes something we REALLY should have fixed a long time ago.

By the way, it turns out we now have this nice :trac: thing for documentation... not needed here, but just fyi for next time, I just found out about five minutes ago.

@loefflerd
Copy link
Mannequin

loefflerd mannequin commented Mar 12, 2012

comment:12

Apply trac_11208_avoid_headless_quiver_warning_v2.patch

(for patchbot)

@jdemeyer
Copy link

Merged: sage-5.0.beta9

@kcrisman
Copy link
Member Author

comment:14

Upstream report is here.

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

No branches or pull requests

4 participants