开发者

gnuplot and "Failed to initialize wxWidgets"

开发者 https://www.devze.com 2023-03-07 15:00 出处:网络
i want to plot120 files with gnuplot. plot \'18205.plot\' u 1:3 w l t \'18205\' , \'18208.plot\' u 1:3 w l t \'18208\'

i want to plot120 files with gnuplot.

plot '18205.plot' u 1:3 w l t '18205' , '18208.plot' u 1:3 w l t '18208'
Failed to initialize wxWidgets.
         warning: Warning - difficulty fitting plot titles into key
         warning: Too many axis ticks requested (>1e+01)
         warning: Too many axis ticks requested (>1e+01)
         warning: Too many axis ticks requested (>6)

the files looking like

21     开发者_开发问答 4       0.865671
22      4       0.894175
23      4       0.921895
24      4       0.949053
25      4       0.975792
26      4       1.00147
27      4       1.02577
28      4       1.05008


Apparently this is it failing to detect a terminal it likes. On my Debian stable "gnuplot 4.4 patchlevel 0" I get an identical error until I add some:

set terminal png

...at which point it works fine. Raaage!


The important bit is this:

Failed to initialize wxWidgets.

This means that gnuplot couldn't open a window to plot using wxWidgets. Be sure that the terminal where you are running gnuplot can open windows in X. You can do that by typing echo $DISPLAY in the terminal (or !echo $DISPLAY from within gnuplot) and checking if it's not empty and if it makes sense (usually this means a value of :0.0. If it should be anything different, you should know that because you have set it up that way ;) ).

Setting the right X permissions is also necessary if you are running gnuplot as a different user (or on a different host e.g. via ssh) than the one running the graphic environment. in a secure environment xhost + would do, but if you are on a network and specially not behind a firewall, xhost server-running-gnuplot.domain would be a much wiser choice.


I was getting the same errors. However, I realised that I did not have X permissions in my current terminal window. This would explain why switching terminal formats to non-X (ie. jpg/png) worked for the guys above as well.


As the warning suggest you probably have too many keys in you plot. Try leaving away the titles and set key off.
Also you might want to take a look at iterations like in THIS blog at the bottom. This would clean up your script quite a lot.
You might want to ask yourself if you really want to plot 120 lines in a singe plot!?


just set area size, such as:

set terminal png size 1500 1200

and then plot


I was getting the same error. Switching to a different output format fixed it for me.

To have your graph be a jpg: set term jpeg

To see all possible output formats: help term

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号