Problems plotting with Octave

删除回忆录丶 提交于 2020-01-24 17:27:29

问题


I've just started using Octave. When I start octave and try to plot something, the plot works but I get the following warnings repeated many times:

warning: ft_render: unable to load appropriate font
warning: ft_render: invalid bounding box, cannot render

More warnings appear if I click and drag the plot or even mouse-over it. If I then try to add an xlabel or title, I get a segfault and octave quits. The default graphics_toolkit is fltk, which I found by starting octave and running

graphics_toolkit();

If I start octave and try

graphics_toolkit("gnuplot");
x=-10:0.1:10;
plot(x,sin(x));

the plot works, but I still get the warning about the bounding box. Adding labels or titles works but gives more bounding box warnings.

Here's the weird bit. If I now change the toolkit back to fltk, and plot again,

graphics_toolkit("fltk");
x=-10:0.1:10;
plot(x,sin(x));

Then the plot works, and only the bounding box warning shows up, and I can add labels etc. In other words, the same behaviour as gnuplot. In fact, the plot looks more like a gnuplot one than an fltk one (judging by the buttons along the bottom). But if I start octave and try this:

graphics_toolkit("gnuplot");
graphics_toolkit("fltk");
x=-10:0.1:10;
plot(x,sin(x));

Then it seems like it's back in the fltk environment as both warnings occur and labels cause a segfault again.

Two questions:

  1. What are the bounding box/font rendering warnings on fltk and the bounding box ones on gnuplot and how do I fix them?

  2. What is going on with the fltk toolkit? It doesn't seem to be possible to change back to it after using gnuplot.

I'm using Octave 3.8.0 on Ubuntu 12.04.


回答1:


I have the same error:

warning: ft_render: unable to load appropriate font
warning: ft_render: invalid bounding box, cannot render

Update the fontconfig library to fontconfig1 library with the following command:

sudo apt-get install glpk gperf flex bison libfontconfig1-dev

Then re-install octave with the following commands:

./configure
sudo make
sudo ./run-octave 
sudo make install

That solves the problem. If not, go to this link for more answers: http://verahill.blogspot.com/2012/02/debian-testing-wheezy-64-compiling.html




回答2:


First I have to say I am not Octave user, so I may be guessing here... ft_render is a class probably used to render text (therefore the name contains "ft" - FreeType). If it can't load the appropriate font (question is which one?), it can't calculate the bounding box for the text that needs to be rendererd. So, the first thing I would check is what font(s) Octave requires for these kind of operations - maybe it is simply not installed.




回答3:


I had the same problem and solved it with {aptitude install fonts-freefont-otf} as {root}.



来源:https://stackoverflow.com/questions/21955036/problems-plotting-with-octave

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!