@interact with non-Sage objects

70 views
Skip to first unread message

gsever

unread,
Jan 24, 2010, 12:20:33 AM1/24/10
to sage-support
Hello,

Is it possible to use the @interact with the following code-snippet? I
want experiment with distributions functions that Scipy have but not
in Sage.

Thanks

from scipy import stats
import numpy as np
import matplotlib.pyplot as plt

@interact
def plot_norm(loc=(0,(0,10)), scale=(1,(1,10))):
rv = stats.norm(loc, scale)
x = np.linspace(0,10)
plt.plot(x,rv.pdf(x))
plt.show()

Harald Schilly

unread,
Jan 24, 2010, 6:49:17 AM1/24/10
to sage-support
Last line must be plt.savefig('plt.png') and not .show() because you
are on a website and saved files are shown. When I tried it first, it
didn't update the image because it was somehow locally cached. On
second try it worked ...

H

gsever

unread,
Jan 24, 2010, 11:06:10 AM1/24/10
to sage-support


Thanks this helped. Adding a plt.clf() clear the figure after each
plot update.

Harald Schilly

unread,
Jan 24, 2010, 12:14:55 PM1/24/10
to sage-support
On Jan 24, 5:06 pm, gsever <gokhanse...@gmail.com> wrote:
> Thanks this helped. Adding a plt.clf() clear the figure after each
> plot update.

no problem, and i looked for a .reset or similar, thanks for the .clr
()!
Can you post this somewhere to the wiki.sagemath.org/interact/graphics
(or a better topic?) as an example how to do interact with matplotlib
directly?
TIA, H!

gsever

unread,
Jan 24, 2010, 12:50:20 PM1/24/10
to sage-support

Added as first wiki entry :)

http://wiki.sagemath.org/interact/graphics#Interactwithmatplotlib

Will also cross-post at matplotlib, numpy and scipy users. I didn't
know I am the first officially documenting this.

Thanks for your help

Harald Schilly

unread,
Jan 24, 2010, 1:39:25 PM1/24/10
to sage-support
On Jan 24, 6:50 pm, gsever <gokhanse...@gmail.com> wrote:
> Added as first wiki entry :)

No problem, and i hope it's ok that i pushed you to do it ;)

http://twitter.com/sagemath/status/8158003421

gsever

unread,
Jan 24, 2010, 6:39:44 PM1/24/10
to sage-support

It was my pleasure Harald.

Sage is one of the well designed approaches to blur the boundaries
among being a user, developer and contributor in the open-source
ecosystem. Probably I will be hanging around for a long time be it
bugging, complaining, documenting, adding content and eventually
digging into source codes ;)

Harald Schilly

unread,
Jan 25, 2010, 4:59:15 AM1/25/10
to sage-support
On Jan 25, 12:39 am, gsever <gokhanse...@gmail.com> wrote:
> It was my pleasure Harald.
>

;)

And guess who just made it on that page: http://sagemath.org/library-stories.html

Gokhan Sever

unread,
Jan 25, 2010, 12:23:39 PM1/25/10
to sage-support

Thanks for making me famous :) (Put in my blog as well --
http://pycloud.blogspot.com/

I am interested in poetry and like some of the burma's at
http://www.sagemath.com/library-marketing.html.

One day, I might come up with a couple interesting quartets for Sage.

Message has been deleted

calc...@aol.com

unread,
Jan 25, 2010, 1:09:34 PM1/25/10
to sage-s...@googlegroups.com
Csn I get my SAGE related posts from my blog added to
planet.sagemath.org?

TIA,
A. Jorge Garcia
http://calcpage.tripod.com

Teacher & Professor
Applied Mathematics, Physics & Computer Science
Baldwin Senior High School & Nassau Community College

Gokhan Sever

unread,
Jan 25, 2010, 1:17:18 PM1/25/10
to sage-support

On Jan 25, 12:09 pm, calcp...@aol.com wrote:
> Csn I get my SAGE related posts from my blog added to
> planet.sagemath.org?
>
> TIA,

> A. Jorge Garciahttp://calcpage.tripod.com


>
> Teacher & Professor
> Applied Mathematics, Physics & Computer Science
> Baldwin Senior High School & Nassau Community College

*** Online Since 1988 ***

How did you manage this :)

calc...@aol.com

unread,
Jan 25, 2010, 1:27:21 PM1/25/10
to sage-s...@googlegroups.com
Well, the internet does predate the web...

HTH,
A. Jorge Garcia

Message has been deleted

calc...@aol.com

unread,
Jan 25, 2010, 1:45:56 PM1/25/10
to sage-s...@googlegroups.com
>>
Yes, your blog could be listed on Planet Sage. But you must first
categorize or label your (Sage-specific) posts. Otherwise, Planet Sage
would aggregate every new posts from your blog.
<<

Well how do I do this, will "SAGE" in the title of a post suffice?

HTH,
A. Jorge Garcia
http://calcpage.tripod.com

Teacher & Professor
Applied Mathematics, Physics & Computer Science
Baldwin Senior High School & Nassau Community College


-----Original Message-----
From: Minh Nguyen <nguye...@gmail.com>
To: sage-s...@googlegroups.com
Sent: Mon, Jan 25, 2010 1:29 pm
Subject: Re: [sage-support] Re: @interact with non-Sage objects

Hi,

On Tue, Jan 26, 2010 at 5:09 AM, <calc...@aol.com> wrote:
> Csn I get my SAGE related posts from my blog added to
planet.sagemath.org?

Yes, your blog could be listed on Planet Sage. But you must first
categorize or label your (Sage-specific) posts. Otherwise, Planet Sage
would aggregate every new posts from your blog.

--
Regards
Minh Van Nguyen

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


Message has been deleted

calc...@aol.com

unread,
Jan 25, 2010, 8:45:30 PM1/25/10
to sage-s...@googlegroups.com
I'm using a blog app attached to my website at tripod.com These blogs
each have different titles but are organized under different topics or
threads. Do I mention SAGE in the titles or do I make a SAGE
topic/threas?

Regards,

Jaap Spies

unread,
Jan 25, 2010, 9:08:11 PM1/25/10
to sage-s...@googlegroups.com
calc...@aol.com wrote:
> Well, the internet does predate the web...
>

I can confirm. My e-mail addresses at that time looked like:

...!mcvax!coi!jaaps!jaap

...!mcvax!owoc!jaap

Hard to imagine nowadays: you had to know the exact route to the addressee.

jaaps was my machine at home. On a daily basis I called coi, etcetera, :)

Jaap

> HTH,
> A. Jorge Garcia
> http://calcpage.tripod.com
>
> Teacher& Professor

> Applied Mathematics, Physics& Computer Science

calc...@aol.com

unread,
Jan 25, 2010, 9:33:28 PM1/25/10
to sage-s...@googlegroups.com
Ah, those were the days...

of archie, gopher, bitnet, uuencode, etc.

HTH,
A. Jorge Garcia
http://calcpage.tripod.com

Teacher & Professor

Jaap Spies

unread,
Jan 25, 2010, 9:45:09 PM1/25/10
to sage-s...@googlegroups.com
calc...@aol.com wrote:
> Ah, those were the days...
>
> of archie, gopher, bitnet, uuencode, etc.
>


archie bunker!?

gopher? You are way ahead! uucp and family are breaking my heart :)

All that on 300 bps or as we said at the time 300 baud.

Or even 110 baud at the teletype. UNIX version 6, 1976!

Cheers,

Jaap

> HTH,
> A. Jorge Garcia
> http://calcpage.tripod.com
>

> Teacher& Professor
> Applied Mathematics, Physics& Computer Science

calc...@aol.com

unread,
Jan 26, 2010, 5:34:47 PM1/26/10
to sage-s...@googlegroups.com
I first taught programming in 1975 using BASIC on a DEC PDP-1170
minicomputer. We connected to it via a 300 baud modem. This was
before video monitors so we used dumb terminals that printed tons of
paper whenever there was any output!

HTH,
A. Jorge Garcia
http://calcpage.tripod.com

Teacher & Professor

calc...@aol.com

unread,
Jan 26, 2010, 5:36:13 PM1/26/10
to sage-s...@googlegroups.com
Don't forget arpanet, bitnet, milnet, timenet, usenet....
Reply all
Reply to author
Forward
0 new messages