Hi Naomi,
Take a look at the lattice package for plotting. An example using your data:
library(lattice)
library(reshape)
a<-c(1,2,3,4,5,6)
b<-c(3,5,4,6,1,1)
c<-c(1,1,1,1,1,1)
bla = data.frame(a,b,c)
# melt is from reshape
bla2 = melt(bla, id.vars = "a")
xyplot(value~a | variable, bla2,
layout = c(1,2),
strip = strip.custom(factor.levels = c("a vs b", "a vs c")))
?melt
?xyplot
xyplot takes care that the axis are equal, no need to set it yourself.
Lattice is a bit harder to get to know than the 'normal' plotting system
in R, but is great for multivariate data.
cheers and good luck,
Paul
Duijvesteijn, Naomi wrote:
Dear R-people
I have a question concerning plotting graphs.
Here an example dataset
a<-c(1,2,3,4,5,6)
b<-c(3,5,4,6,1,1)
c<-c(1,1,1,1,1,1)
d<-as.data.frame(cbind(a,b,c))
plot.new()
plot(d$a, d$b, col="red")
par(new=TRUE)
plot(d$a,d$c, col="red", pch="|")
What I would want is to plot de second plot under the first plot. So not in the
the first plot. There is a way to divide your graph in 2 or 3 parts and use the
same x-axis but I do not seem to get it right. Could somebody help me out?
Thanks in advance!
Regards,
Naomi
Disclaimer: De informatie opgenomen in dit bericht (en bijlagen) kan
vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde(n). Indien u
dit bericht ten onrechte ontvangt, wordt u geacht de inhoud niet te gebruiken,
de afzender direct te informeren en het bericht te vernietigen. Aan dit bericht
kunnen geen rechten of plichten worden ontleend.
------------------------------------------------------------------------------------------------------------------------------------------
Disclaimer: The information contained in this message may be confidential and
is intended to be exclusively for the addressee. Should you receive this
message unintentionally, you are expected not to use the contents herein, to
notify the sender immediately and to destroy the message. No rights can be
derived from this message.
Please consider the environment before printing this email
------------------------------------------------------------------------
______________________________________________
R-help@r-project.org 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.
--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: +3130 274 3113 Mon-Tue
Phone: +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul
______________________________________________
R-help@r-project.org 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.