首页 文章

无法在Octave中保存复杂的图表

提问于
浏览
2

我在Windows 7系统上运行Octave 3.6.4 .

我很难将情节保存为.png文件 . 有些复杂的图(几个子图,很多图例,160万个数据点)只能使用非常大的图像大小保存,甚至有时只能使用 .

一个具体的例子( Headers 和轴标签省略):

figure (11)
clf ;

subplot (1,2,1) ;
plot (ratingRepeated, (predictions - Ymean)(:), ".k", "markersize", 1) ;
axis([0.5 5.5 -4 8]) ;
grid("on") ;

subplot (1,2,2) ;
plot (ratingRepeated, predictions(:), ".k", "markersize", 1) ;
axis([0.5 5.5 -4 8]) ;
grid("on") ;

生成包含数百万个数据点的精美绘图 . 但使用:

print -dpng figure11

创建一个只包含一小部分图的图像 . 有时它有助于使用像这样的非常大的图像:

print -dpng "-S3400,2400" figure11

但大多数Octave只是停滞,然后在CTRL C之后崩溃 .

我没有成功尝试过:

  • 使用Octave 3.8.x.

  • 使用gnuplot而不是"fltk":graphics_toolkit("gnuplot")

  • 保存之前关闭除一个绘图之外的所有绘图

  • 最大化绘图窗口

  • 搜索高低解决方案

一些小的但可能相关的问题是:丹麦人物不会出现;情节非常缓慢,情节需要几分钟才能显示和/或保存 .

任何建议将不胜感激 .

1 回答

  • 1

    我认为你试图以错误的方式解决问题 . 您有太多的数据点和正常的散点图,就像您要做的那样,不能很好地显示数据的分布 . 相反,使用某种密度图 . 只需比较这两个:

    x = vertcat (randn (2000000, 1)*3, randn (1000000, 1) +5);
    y = vertcat (randn (2000000, 1)*3, randn (1000000, 1) +5);
    plot (x, y, ".")
    

    simply plotting the thousand of data points

    pkg load statistics;
    data = hist3 ([x y], [100 100]);
    imagesc (data)
    axis xy
    colormap (hot (124)(end:-1:1,:)) # invert colormap since hot ends in white
    

    imagesc with inverted hot colormap

    您可以使用现有的色彩映射(请参阅 colormap list )或创建自己的色彩映射 . 最常见的是喷射(不是因为它是好的,但因为它是默认的)

    colormap (jet (124))
    

    imagesc with jet colormap

相关问题