From: John Kane <jrkrideau_at_yahoo.ca>

Date: Wed 06 Sep 2006 - 13:17:28 GMT

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed Sep 06 23:23:12 2006

Date: Wed 06 Sep 2006 - 13:17:28 GMT

- JeeBee <JeeBee@troefpunt.nl> wrote:

> gallon li wrote:

*>
**> I have found this one before. However, my intension
**> is slightly differing
**> from this plot: I wish to plot the histogram in the
**> backgroun instead of
**> in the margin. Thanks anyway!
**>
**> On Wed, 06 Sep 2006 12:29:51 +0200, JeeBee wrote:
**>
**> >
**> > How about this?
**> >
**> >
**>
*

http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=78

*> >
**> > JeeBee
*

Can you not just plot the histogram and then the main plot?

Something like this, although it is a barplot rather than a histogram.

Hours <- c(0,1,2,3,4,5)

Nam <- c( "alf", "bet", "cet", "det", NA , fet) En <- c(5, 7, 8, 9, NA, 9) L1 <- c(10, 9, 7, 5, 3 ,6) L2 <- c(7, 4, 3, 2, 5, 7)

MyLabels <- seq(200, 500, length=13)

mp <-barplot(En)

# adjust margins to accommodate titles and labels
especially the 4 axis label.

par(mar=c(5,5,5,5))

barplot(En, ylim=c(0, 12),axes =FALSE, ann=FALSE,
xlab="Hours", ylab="Volume", col.lab="blue")
points (mp,L1, type="p", pch=19, col = "red")
points (mp,L2, type = "l", col="blue")

axis ( 2, 0:12, las=1, font=2)

axis (3, at=1:6, tick =F, labels =c( "alf", "bet",
"cet", "det", NA , "fet"))

axis (4, at = 0:12, labels = MyLabels, font=2)
mtext("Number of Units Detected", 4,

line=3,col="blue")

title ( main="A combined line and bar chart \n with
different x-axis labels", line=3,

font=3, col.main="blue")

box()

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed Sep 06 23:23:12 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Thu 07 Sep 2006 - 07:51:18 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*