SageMathCloud questions: plots, init.sage, etc

31 views
Skip to first unread message

Pierre

unread,
Jul 21, 2015, 10:35:37 AM7/21/15
to sage-s...@googlegroups.com
Hi,

I've been playing with the Jupyter notebook in sagemathcloud, it's very nice. I have a few questions:

(1) I was trying to plot a few things, following the recommandations here:

https://github.com/sagemathinc/smc/wiki/FAQ#ipython-nb

The proposed code is

def showplot(g):
    import IPython.display
    save(g, 'a.png')
    display(IPython.display.Image('a.png'))

I'm pretty sure the last line is incorrect -- it doesn't work for me anyway, and things are fixed if you change it to
IPython.display.display(IPython.display.Image('a.png'))

OK so that's not really a question, more of a documentation error report :-)


(2) I've been trying to improve it to

def showplot(g, **kwargs): import IPython.display save(g, 'a.png', kwargs)
IPython.display.display(IPython.display.Image('a.png'))

and tried showplot(my_plot, dpi= 1200) to get a larger image, but it doesn't work... any thoughts?

(normally "dpi" is a keyword for the "show" function)

(3) I've put the function showplot inside .sage/init.sage, it works within jupyter (not within a sage worksheet, the init.sage is ignored entirely, but that's another story, and for the moment i don't care). I was wondering however if there was a way to have the same init.sage for all the projects? or, for that matter, how to share a file between several or all projects?

or is the idea that each "project" is like a separate computer running? (it feels very much like it, and i also think i remember reading this in the documentation somewhere)

(4) This is a bit unrelated, but: does the editor on sagemathcloud (the one that pops up when you click on a .sage file) have any auto-completion features at all?

Thanks !

Pierre

William Stein

unread,
Jul 21, 2015, 10:47:16 AM7/21/15
to sage-s...@googlegroups.com
No, it doesn't.  Editing sagews files does though. 

 
 


 

--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To post to this group, send email to sage-s...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


--
Sent from my massive iPhone 6 plus.

Pierre

unread,
Jul 21, 2015, 11:43:09 AM7/21/15
to sage-s...@googlegroups.com
I can answer a bit of my own question:

(2) I've been trying to improve it to

def showplot(g, **kwargs): import IPython.display save(g, 'a.png', kwargs)
IPython.display.display(IPython.display.Image('a.png'))

and tried showplot(my_plot, dpi= 1200) to get a larger image, but it doesn't work... any thoughts?


OK so *of course* the third line should be
    save(g, 'a.png', **kwargs)
 
and it works. But don't try dpi= 1200, or you will end up with a dead kernel !

Justin C. Walker

unread,
Jul 21, 2015, 5:30:59 PM7/21/15
to sage-s...@googlegroups.com

On Jul 21, 2015, at 07:35 , Pierre wrote:

> Hi,
>
> I've been playing with the Jupyter notebook in sagemathcloud, it's very
> nice. I have a few questions:
[snip]
> and tried showplot(my_plot, dpi= 1200) to get a larger image, but it
> doesn't work... any thoughts?

This is probably obvious, but: is the above literally what you used, or is the space after "=" creeping in during message creation?

HTH

--
Justin C. Walker, Curmudgeon-At-Large
Institute for the Enhancement of the Director's Income
--------
Experience is what you get
when you don't get what you want.
--------



Pierre Guillot

unread,
Jul 21, 2015, 5:34:00 PM7/21/15
to sage-s...@googlegroups.com

The space is no trouble. But see my second message, i had forgotten the **. Now that bit works!

--
You received this message because you are subscribed to a topic in the Google Groups "sage-support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-support/rju_T6XE7EU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-support...@googlegroups.com.

Pierre Guillot

unread,
Jul 21, 2015, 5:35:25 PM7/21/15
to sage-s...@googlegroups.com

PS in case i did not make myself clear: things work for reasonable values of dpi, but not 1200 which is silly.

Reply all
Reply to author
Forward
0 new messages