Skip to content
This repository has been archived by the owner on Apr 16, 2018. It is now read-only.

make it so plotting from octave worksheets... just works #97

Open
williamstein opened this issue Feb 13, 2014 · 1 comment
Open

make it so plotting from octave worksheets... just works #97

williamstein opened this issue Feb 13, 2014 · 1 comment

Comments

@williamstein
Copy link
Contributor

Requested by Heather Van Dyke.

I'll do this in much the same way I made plotting just work for R worksheets. The key idea is illustrate by the following:

ONE. Run this code in a new Sage Worksheet before running octave.

os.environ['GNUTERM']='svg'
def octave_plot():
    _=octave.eval("print /%s/.tmp.svg"%os.path.abspath('.'))
    salvus.file('.tmp.svg')

TWO. Run this code in a cell to draw an Octave plot:

%octave
clf()
x = -10:0.1:2;
plot (x, sin(x))

THREE. Now type octave_plot() in a cell to render the current octave plot!

screen shot 2014-02-13 at 9 13 56 am

@williamstein
Copy link
Contributor Author

I also want to point out how -- right now -- one can use Octave in a terminal with graphics and for editing files. These illustrate how SageMathCloud already has all the tools needed to build a standard matlab-style web-based UI around Octave -- the actual . Right now you can simulate such a thing by opening three browser windows at once.

ONE: Create a new terminal by clicking "+New --> Terminal".

TWO: Run octave like this:

GNUTERM=svg octave

THREE: create and save a plot

octave:1> fplot (@sin, [-10, 100]);
octave:2> print a.svg;

FOUR: Click files in the upper left, then click on the file "a.svg" to see the plot. When you change you it you can refresh it. You can also copy/paste the link to open it in another browser window.

FIVE: You can also edit a file such as foo.m (use +New --> "foo.m" [File]), with proper syntax highlighting, auto-indent, etc. When you want to read in the code from there to the terminal, you can source foo.m.

screen shot 2014-02-13 at 9 28 47 am

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

No branches or pull requests

1 participant