On Tue, Mar 1, 2011 at 3:43 PM, Jason Grout <jason-s...@creativetrax.com> wrote:
> On 3/1/11 3:58 AM, Fredrik Johansson wrote:
>>
>> On Tue, Mar 1, 2011 at 4:30 AM, Francois Bissey
>> <francois.bis...@canterbury.ac.nz>  wrote:
>>>>
>>>> On Mon, 28 Feb 2011 at 01:26PM -0800, jtyard wrote:
>>>>>
>>>>> I'm running sage 4.6.1 and cannot use plot after loading mpmath.
>>>>> Namely, running
>>>>>
>>>>>> from mpmath import *
>>>>>> plot(lambda t: sin(2*pi*t), [1, 4])
>>>>>
>>>>> produces no output in the notebook.  I'm loading mpmath because I need
>>>>> to make plots of theta functions, and the page
>>>>>
>>>>>
>>>>>
>>>>> http://mpmath.googlecode.com/svn/trunk/doc/build/functions/elliptic.html#
>>>>> jacobi-theta-functions
>>>>>
>>>>> tells me to first run "from mpmath import *" to gain access to jtheta.
>>>>
>>>> I'm not 100% sure what's going on, but I do see that mpmath has its own
>>>> plot function, and your "from mpmath import *" line overwrites Sage's
>>>> usual plot function with mpmath's.
>>>>
>>>> This works:
>>>>
>>>> sage: import mpmath
>>>> sage: plot(lambda t: mpmath.sin(2*pi*t), (1,4))
>>>>
>>>> So I guess the question is, why isn't mpmath's plot function working?
>>>>
>>> Interestingly mpmath-0.16 and 0.17 have support for matplotlib so
>>> presumably
>>> those can use matplotlib for plot.
>>
>> mpmath basically justs calls pylab.show(), which doesn't do anything
>> in the notebook (nor in the Sage interpreter). We could hack mpmath in
>> Sage to be more clever. Alternatively, perhaps a better solution would
>> to make pylab.show() work in Sage. Is this feasible?
>
> If you compile with SAGE_MATPLOTLIB_GUI (and you have the prerequisites so
> that one of the GUI backends is built), then I believe pylab.show() works
> just fine.

Ah, nice. Still, it would be nice if matplotlib could be used to
generate plots directly in the notebook, by default.

Fredrik

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to