Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I enable the pngcairo terminal in Gnuplot

I would like to plot a figure to PNG format (avoiding using convert), however my Gnuplot distribution does not offer the PNGCAIRO terminal. How can I install/enable it? I use Gnuplot 4.4, patchlevel 2 on Mac OS X 10.6.

[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
like image 609
TMOTTM Avatar asked May 08 '12 10:05

TMOTTM


3 Answers

If you are running homebrew, you can install everything with just one command line

brew install gnuplot --with-cairo

like image 138
Anvaka Avatar answered Nov 12 '22 10:11

Anvaka


If your package manager (e.g. macports or fink) doesn't have a suitable gnuplot, then you're probably going to need to build gnuplot from source yourself. Gnuplot itself isn't too difficult, but if you want a specific terminal (e.g. pngcairo) you'll need to download and build the dependencies yourself before building gnuplot -- in this case libcairo.

Gnuplot also has a regular png terminal which should exist if your gnuplot distribution was able to find libgd at compile time or your package manager included it.

And easy way to tell which terminals you have enabled is to just type set terminal in an interactive gnuplot window. That will print a list of all the terminals that your gnuplot is able to use (which depends on the libraries it was compiled with)

Sorry if this isn't a lot of help.

like image 36
mgilson Avatar answered Nov 12 '22 11:11

mgilson


I upgrade gnuplot to 5.0.1 and encounter the same issue. Here is what I do.

To install gnuplot 5.0.1, download the source file from here, and then:

#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
like image 35
SparkAndShine Avatar answered Nov 12 '22 10:11

SparkAndShine