Octave(matlab),如何创建绘图而不显示?

发布于 2024-12-23 22:51:08 字数 159 浏览 3 评论 0原文

八度问题(matlab)。在程序中,我有一个循环来绘制数据。在每个循环结束时,我将绘图保存到光盘上。在此过程中,八度绘制每个图。它减慢了这个过程。我只需要将绘图保存在光盘上。如果我无法显示它们,而只是保存,则会大大加快该过程。有没有办法将绘图绘制到处理程序而不显示它?我使用 scatter 函数来绘制。

The problem with octave(matlab). In the program I have loop where I plot data. In the end of each loop I save plots to disc. During this process octave draw each plot. It slows down the process. I need only plots to be saved on disc. If I could not display them,but just save, it would considerably accelerate the process. Is there way to draw plot to handler without displaying it? to draw I use scatter function.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

风筝在阴天搁浅。 2024-12-30 22:51:08

这没有用 matlab 进行测试,并且可能仅限于八度。

使用 f =figure('visible','off') 无法开箱即用。

您需要选择合适的图形工具包:

available_graphics_toolkits 
ans = 
{
  [1,1] = fltk
  [1,2] = gnuplot
}

默认为fltk,它无法在不显示绘图的情况下写入文件。但是,如果您选择 gnuplot ,它将能够写入文件而不先显示它:

graphics_toolkit gnuplot

f = figure('visible','off')
plot(...)
axis(...)
filename=sprintf('output/%05d.png',t);                                                                          
print(filename); 

它不是特别快,但它不使用屏幕缓冲区或捕获鼠标,如果绘图会发生这种情况需要可见。

This is not tested with matlab, and potentially only limited to octave.

Using f = figure('visible','off') will not work out of the box.

You need to select a proper graphics toolkit:

available_graphics_toolkits 
ans = 
{
  [1,1] = fltk
  [1,2] = gnuplot
}

The default is fltk which cannot write to file without displaying the plot. However, if you select gnuplot it will be able to write to file without displaying it first:

graphics_toolkit gnuplot

f = figure('visible','off')
plot(...)
axis(...)
filename=sprintf('output/%05d.png',t);                                                                          
print(filename); 

It is not particularly fast, but it doesn't use screen buffers or captures the mouse, which happens if the plot needs to be visible.

甜是你 2024-12-30 22:51:08

正如这个问题,我会这样做:

f = figure('visible','off')

As answered in this question, I would do:

f = figure('visible','off')
窗影残 2024-12-30 22:51:08

自使用 OSMesa 的 GNU Octave 4.0 起,GNU/Linux 就支持离屏渲染。因此,今天基本上有两种方法可以让 figure ("visible", "off");... print (...) 工作:

  1. 如果您没有专有的 OpenGL 驱动程序,而是基于 MESA像 radeon、nouveau 等驱动程序(基本上所有免费(如自由)驱动程序都基于 Mesa)您可以使用基于 OpenGL 的工具包(qt、fltk),Octave 将使用 OSMesa 进行打印。
  2. 使用 gnuplot:graphics_toolkit gnuplot 如前所述

Offscreen rendering is supported on GNU/Linux since GNU Octave 4.0 using OSMesa. So today there are basically two ways to get figure ("visible", "off");... print (...)working:

  1. If you not have a proprietary OpenGL driver but a MESA based driver like radeon, nouveau and so on (basically all free (as in freedom) drivers are based on Mesa) you can use OpenGL based toolkits (qt, fltk) and Octave will use OSMesa for printing.
  2. Using gnuplot: graphics_toolkit gnuplot as said before
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文