> 1) create a new worksheet (no matter which mode), for example at sagenb.org > > 2) > > import pylab > pylab.plot([1, 2, 3], [1, 2, 1]) > pylab.savefig("a.png") > > # it plots a plot, all a-ok > > 3) go back and change [1, 2, 1] to [1, 2, 3], reevaluate, it will > produce this messed up plot: > > http://www.sagenb.org/home/pub/281/ > > > And here is how to fix it: > > 1) add pylab.cla() right after "import pylab" and rerun it. > > So it's a matplotlib feature. Sorry about the confusion.
I've been frequently very confused by this feature of matplotlib/MATLAB. It's less confusing when there is an interactive window that pops up -- when rendering to an off-screen buffer it is often easy to forget to clear things. > > >>> 1) how can I change what gets imported by default in an empty >>> worksheet? I use Python mode, but sage still gets imported and it >>> polutes the namespace. :) >> >> Hmmm... First, this can definitely be fixed. >> [takes 10 minutes] >> OK, I wrote a small patch that modifies the sage notebook so that it >> starts up all worksheet processes in Pure Python mode without >> importing the sage library. It's a 2-line modification to >> notebook/worksheet.py. See attached. After applying this the >> individual worksheets will actually startup a lot faster and be more >> lightweight, but of course no specific sage functionality is available >> unless one does "import sage.all". Tab completion and introspection >> still works fine though without importing sage.all. >> gh > > Thanks William for the patch, it does exactly what I wanted. I updated > my server, now I have a better address: > > http://nb.hpfem.org/ > > If yo go there, you can see that I customized it a bit --- when I find > more time, I'll probably change colors or something to make it more > different, so that people don't confuse my local modifications with > the default sage notebook. Very nice! > Is it ok with you if I rename it from Sage notebook to Hermes notebook > and only leave a link to sagemath.org at the front page and in the > help? Well, I know it's opensource, so I could do that, but I meant if > you have some long term strategy how you would like people to use & > install the modified sage notebooks. It is *definitely* OK. You have my official written permission to rebrand your server "Hermes notebook". > Some other things I have been doing with the notebook: > > Since my research topis is electronic structure calculations, I took > the most famous electronic structure program abinit.org, which is in > fortran, I replaced their build system with cmake, installed it into > Sage, wrote Python wrappers that produce input files and read output > files from it, installed it to Sage and here is how it looks like: > > http://nb.hpfem.org/home/pub/7/ > > Now I need to play with graphics, e.g. create plots from all the > programs that I am interested in and then it will start to rock. Then > I'll try to interface all the other programs too. > > I am surprised noone did that before (I mean except Sage for some math > programs), but it's so obvious thing to do. I want all my programs and > everything I use to be easily available in the notebook, so that I can > play with it whenever I am and show it live during > teaching/presentations. And also invite other people to play with it > too, if it's just a few mouse clicks. Well, I just wasn't thinking > this way before either, but now it's clear to me that this is the way > to go. > > Ondrej +1 It's very nice to have everything under one roof. -- William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---