[R] barplots with pictex

Faheem Mitha faheem at email.unc.edu
Tue Feb 6 21:36:44 CET 2001


This didn't seem to go through (perhaps because of the capital R) so I am
resending it.                             Faheem.

---------- Forwarded message ----------
Date: Tue, 6 Feb 2001 14:36:53 -0500 (EST)
From: Faheem Mitha <faheem at email.unc.edu>
To: R-help at stat.math.ethz.ch
Subject: barplots with pictex

Dear R People, 

I want to include a barplot corresponding to a simple discrete probability
distribution in a LaTeX document. I decided to use the pictex
driver. After a certain amount of messing about, I came up the lines
below. It does not look too bad, however, there is one very obvious piece
of weirdness, ie. the y axis terminates at 0.1 and does not extend down
further. I tried to adjust this by changing ylim to c(-0.1,0.5) but then
the labelling -3, -2 ... moves further down. Can anyone suggest how to
correct this problem?

I am not sure what significance xlim has in this situation. I set it equal
to c(-3,10) but then it cut off half the graph. So I just left it off.
Yes, I did look at the online help, but still had difficulties.

Two more comments/questions: 

1) If anyone can suggest a better way of doing this, please let me know.

2) Are there any obvious advantages to using pictex instead of say eps? I
thought there might be an advantage to being able to adjust parameters by
hand, but the pictex code that is put out by the driver is quite
complicated, and in any case no documentation comes for pictex (you have
to buy the manual), so I don't know what I am doing anyway.

pictex(file="barplot.tex",width=6,height=3, debug=FALSE,bg
="white",fg="black")
barplot(c(0.1,0.2,0.2,0.4,0,0,0,0,0,0,0,0,0,0.1),names.arg=
        c("-3","-2","-1","0","1","2","3","4","5","6","7","8","9","10"),
        ylim=c(0,0.5),xlab="Values of x",ylab="Probability
values",sub=NULL,
    style="old",main="Probability Histogram")
dev.off()

Thanks in advance for any help.

                  Sincerely, Faheem Mitha.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list