1 | initial version |

You can print to a file from the terminal using the `print`

command. For example,

```
x=0:0.1:10
figure()
plot(sin(x))
print('~/sine.jpg')
```

2 | No.2 Revision |

You can print to a file from the terminal using the `print`

command and then open the jpg file in SMC using the `open`

command via Octave's `system`

command. ~~For example,~~Here is my .m file:

~~x=0:0.1:10
figure()
plot(sin(x))
print('~/sine.jpg')
~~x=0:0.1:10;
figure();
plot(sin(x));
print('~/sine.jpg');
system('open sine.jpg');

This will pop open the graph in a new tab within SMC.

3 | No.3 Revision |

You can print to a file from Octave in the terminal using the `print`

command and then open the jpg file in SMC using the `open`

command via Octave's `system`

command. Here is my .m file:

```
x=0:0.1:10;
figure();
plot(sin(x));
print('~/sine.jpg');
system('open sine.jpg');
```

This will pop open the graph in a new tab within SMC.

If you are working from within a worksheet in SMC, you can get the graph to display within the worksheet by using:

```
%octave
x = 0:0.1:10;
h = figure('visible', 'off');
plot(sin(x));
saveas(h,"~/fig.png");
%sage salvus.file("fig.png")
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.