简体   繁体   English

用八度显示图形窗口

[英]Showing the figure window with octave

I am a very newbie to octave. 我是个八度的新手。

I want to show the figure I plot with octave, but no figure window shows up. 我想显示用八度绘制的图形,但是没有图形窗口显示。

Here is what I want to plot, plot.m 这是我要绘制的图plot.m

x = load('ex2x.dat');
y = load('ex2y.dat');
figure % open a new figure window
plot(x, y, 'o');
ylabel('Height in meters')
xlabel('Age in years')

I run the script with the command line directly 我直接使用命令行运行脚本

octave plot.m

The dataset can be downloaded from http://openclassroom.stanford.edu/MainFolder/DocumentPage.php?course=DeepLearning&doc=exercises/ex2/ex2.html 可以从http://openclassroom.stanford.edu/MainFolder/DocumentPage.php?course=DeepLearning&doc=exercises/ex2/ex2.html下载数据集。

I have installed image package as the site suggested. 我已经按照网站建议安装了映像包。

My OS is ubuntu 14.04, I am not sure if I miss something. 我的操作系统是ubuntu 14.04,我不确定是否错过了什么。

I appreciate any help. 感谢您的帮助。

Thank you! 谢谢!

I found the answer which can be found in Octave's FAQ. 我找到了可以在Octave常见问题解答中找到的答案。

http://wiki.octave.org/FAQ http://wiki.octave.org/常见问题

If you are running an Octave script that includes a plotting command,
the script and Octave may terminate immediately. So the plot window
does show up, but immediately closes when Octave finishes execution.
Alternatively, if using fltk, the plot window needs a readline loop to
show up (the time when Octave is sitting around doing nothing waiting for interactive input).
A common solution is to put a pause command at the end of your script.

So I just to add pause in the end of my script and it shows the window. 因此,我只需要在脚本末尾添加pause ,它就会显示窗口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM