[R] Color conversion of ps to pdf

Martin Maechler maechler at stat.math.ethz.ch
Wed Apr 16 10:27:59 CEST 2003

(Corrected "Subject" !)

>>>>> "Marwan" == Marwan Khawaja <marwan.khawaja at aub.edu.lb>
>>>>>     on Wed, 16 Apr 2003 09:41:07 -0700 writes:

    Marwan> Hello,
    Marwan> I get a nice looking barplot using the barplot2 function in the gregmisc
    Marwan> package:

    Marwan> body2 <- barplot2(hh3, beside = TRUE,
    Marwan> col = c("mistyrose", "lightcyan"),
    Marwan> ....
    Marwan> cex.names = 1.0, plot.ci = TRUE, ci.l = cil, ci.u = ciu,
    Marwan> plot.grid = TRUE)
    Marwan> box()

    Marwan> However, obviously I lose the collors when
    Marwan> converting from ps to a pdf (outside of R) but I get
    Marwan> a single shaded pattern!  Is it my choice of
    Marwan> collors? Or the conversion software I am using?  Any
    Marwan> help would be appreciated.  TIA Marwan

a more useful example using standard R functions and
reproducible data --- from  help(barplot) :

postscript("barp-VAD.eps", onefile=FALSE, horizontal=FALSE,
           height=4, width=6)

     data(VADeaths, package = "base")
     barplot(VADeaths, beside = TRUE,
             col = c("lightblue", "mistyrose", "lightcyan",
                     "lavender", "cornsilk"),
             legend = rownames(VADeaths), ylim = c(0, 100))
     title(main = "Death Rates in Virginia", font.main = 4)


## Using Latex's epstopdf
system("epstopdf barp-VAD.eps") #--> barp-VAD.pdf 
## Use Acrobat reader:
system("acroread  barp-VAD.pdf &")
## alternatively, requiring a newer `gv' (GView) which can deal with pdf:
system("gv  barp-VAD.pdf &")

Looks perfect  (Linux).
Hence, yes, it's your conversion software!

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><

More information about the R-help mailing list