Skip to content

barplot2

4 messages · Martin Maechler, Marc Schwartz, Marwan Khawaja

#
(Corrected "Subject" !)
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)

dev.off()

## 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			<><
#
Marwan,

I don't have your full code, but I used barplot2() in R 1.6.2 under
WinXP Pro to generate a simple bar plot with two bars in the colors
that you have above. I can generate a .PS file and then convert it to
.PDF using GhostScript/GSView and default settings without problem.
The colors are properly retained.

Can you provide your full code so that I can exactly replicate your
plot and specify what program you are using to do the PS to PDF
conversion?

Regards,

Marc Schwartz
5 days later
#
I want to thank Mark Schwartz and Martin Meachler for their suggestions re
conversion to pdf.
Obviously, the problem was witht the conversion software used --
GhostScript/GSView solved it.
Thanks again Marwan

=======================
Marwan Khawaja					marwan.khawaja at aub.edu.lb
Associate Professor & Director				http://webfaculty.aub.edu.lb/~mk36
Center for Research on Population & Health
Faculty of Health Sciences				Tel:  +961 1 35 00 00 ext. 4668 (O)
American University of Beirut				       +961 1 35 00 00 ext. 4640 (O))
P.O.Box 11--0236, Riad El-Solh				       +961 1 35 00 00 ext. 2821 (H)
Beirut 1107 2020, Lebanon 				Fax: +961 1 74 44 70


-----Original Message-----
From: Marc Schwartz [mailto:mschwartz at medanalytics.com]
Sent: Wednesday, April 16, 2003 5:43 AM
To: 'Marwan Khawaja'; 'R'
Subject: RE: [R] barplot2
Marwan,

I don't have your full code, but I used barplot2() in R 1.6.2 under
WinXP Pro to generate a simple bar plot with two bars in the colors
that you have above. I can generate a .PS file and then convert it to
.PDF using GhostScript/GSView and default settings without problem.
The colors are properly retained.

Can you provide your full code so that I can exactly replicate your
plot and specify what program you are using to do the PS to PDF
conversion?

Regards,

Marc Schwartz