2012-05-08 74 views
14

我想繪製一個PNG格式的圖(避免使用convert),但是我的Gnuplot發行版不提供PNGCAIRO終端。我如何安裝/啓用它?我在Mac OS X 10.6上使用Gnuplot 4.4,patchlevel 2。如何在Gnuplot中啓用pngcairo終端

[me]machine @ test $ gnuplot 

G N U P L O T 
Version 4.4 patchlevel 2 
last modified Wed Sep 22 12:10:34 PDT 2010 
System: Darwin 10.8.0 

Copyright (C) 1986-1993, 1998, 2004, 2007-2010 
Thomas Williams, Colin Kelley and many others 

gnuplot home:  http://www.gnuplot.info 
faq, bugs, etc: type "help seeking-assistance" 
immediate help: type "help" 
plot window:  hit 'h' 

Terminal type set to 'x11' 
gnuplot> set terminal pngcairo 
        ^
    unknown or ambiguous terminal type; type just 'set terminal' for a list 

回答

5

如果你的包管理器(例如macportsfink)沒有合適的gnuplot的,那麼你可能會需要從源代碼建立自己的gnuplot。 Gnuplot本身並不太困難,但是如果你想要一個特定的終端(例如pngcairo),你需要在構建gnuplot之前自己下載並構建依賴項 - 在這種情況下爲libcairo

Gnuplot也有一個常規的png終端,如果你的gnuplot發行版在編譯時能夠找到libgd或者你的軟件包管理器包含了它,終端應該存在。

通過簡單的方法來確定您啓用了哪個終端,只需在交互式gnuplot窗口中鍵入set terminal即可。這將打印出你的gnuplot可以使用的所有終端的列表(這取決於它所編譯的庫)

對不起,如果這不是很多的幫助。

+0

感謝您的答覆。 – TMOTTM

+0

沒問題。對不起,如果它不是非常有用... – mgilson

16

如果您正在運行homebrew,你可以只用一個命令行

brew install gnuplot --with-cairo

+0

'sudo apt-get安裝libcairo2-dev'比較容易。 – SparkAndShine

+5

這個選項在brew中被棄用: 'brew install gnuplot --with-cairo' – cdosborn

4

我升級到gnuplot的5.0.1和遇到同樣的問題,安裝的一切。這是我做的。

要安裝的gnuplot 5.0.1,從here下載源文件,然後:

#decompress it: 
tar -xvf gnuplot-5.0.1.tar.gz 

#install the dependency libraries for cairo-based terminals, like pdfcairo, pngcairo 
sudo apt-get install libcairo2-dev 
sudo apt-get install libpango1.0-dev 


#build it: 
cd gnuplot-5.0.1 
./configure 
make 

#install it: 
sudo make install