[R] Make plots with GNUplot. Have anyone tried that?

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Mar 3 15:16:15 CET 2008


On Mon, 3 Mar 2008, Martin Maechler wrote:

>>>>>> "LH" == Louise Hoffman <louise.hoffman at gmail.com>
>>>>>>     on Sat, 1 Mar 2008 00:54:56 +0100 writes:
>
>    >> If you still want to then read ?write.table, that can export your data
>    >> into a spreadsheet-like ascii format which can be used from GNUplot
>    >> easily.
>
>    LH> Very interesting.
>
>    LH> So if I e.g. write:
>    LH> ts.sim <- arima.sim(list(order = c(1,1,0), ar = 0.7), n = 200)
>    LH> ts.plot(ts.sim)
>
>    LH> How do I know the names of the rows to put in the data.frame() command?
>
>    >> Btw, comparing the graphics capabilities of GNUplot and R, it is
>    >> something like a three-wheel bicycle and a spaceship. Guess
>    >> which is which.
>
>    LH> =) I know that I will most likely spend a lot of time on just making
>    LH> the plots, but I atleast (for now =) ) think it could be fun to try.
>
> if you make them with R, yes.
>
> I wholeheartedly support Gabor's point:
>
> I'd consider GNUplot to be clearly inferior to R -- just talking
> about the graphics possibilties and the quality / thoughtfulness
> in the high-level plotting.
> If you have your data / objects / functions in R,
> I'm very strongly convinced that using GNUplot for plotting is
> ``the wrong'' approach by almost all definitions of "wrong".

In a later message Louise mentioned the desire to use TeX fonts for 
annotation, to match a LaTeX document.  Paul Murrell has pointed out his 
and my article in R-News 2006-2 about how to do this.

Louise almost mentioned the 'the gnuplot cvs which have pdfcairo support'. 
Well, R too has development versions, and I was able to do

> par(family="cmr10")
> plot(1:10)

in R-devel and get annotations in Computer Modern on screen, or

> cairo_pdf()
> par(family="cmr10")
> plot(1:10)

and get this on a PDF file.

To do so you would need /usr/share/fonts/mathml/cmr10.ttf installed, at 
least on F8 (part of the mathml-fonts RPM).

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list