Hello R user, I have created two plots (attached!) using the codes below and would like to merge these figures in one. any suggestions are highly appreciated! Thanks, plot(graph1$yod,graph1$xod,data=graph1) dfx = data.frame(ev1=graph1$xod, ev2=graph1$yod, ev3=abs(graph1$dif)) symbols(x=dfx$ev1, y=dfx$ev2, circles=dfx$ev3,inches=1/8, ann=F, bg="black", fg=NULL,xlim=c(-35,35),ylim=c(-35,35)) abline(h=0,v=0) plot(graph2$yod,graph2$xod,data=graph2) dfx = data.frame(ev1=graph2$xod, ev2=graph2$yod, ev3=abs(graph2$dif)) lines(symbols(x=dfx$ev1, y=dfx$ev2, circles=dfx$ev3,inches=1/8, ann=F, bg="blue", fg=NULL,xlim=c(-35,35),ylim=c(-35,35))) abline(h=0,v=0) Best, Bibek
What do you mean by "merge these figures in one"? If you want two figures on one page, see ?par - specifically mfrow and mfcol. If you want both sets of data in one figure, maybe ?points or ?lines though I see you're already familiar with at least ?lines. The list doesn't take most attachments, and you might also take a look at: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Asking intelligible questions is the best strategy for receiving intelligible answers. Sarah On Tue, Dec 17, 2013 at 12:33 PM, bibek sharma <mbhpathak at gmail.com> wrote:> Hello R user, > > I have created two plots (attached!) using the codes below > and would like to merge these figures in one. any suggestions are highly > appreciated! > Thanks, > > plot(graph1$yod,graph1$xod,data=graph1) > dfx = data.frame(ev1=graph1$xod, ev2=graph1$yod, ev3=abs(graph1$dif)) > symbols(x=dfx$ev1, y=dfx$ev2, circles=dfx$ev3,inches=1/8, ann=F, > bg="black", fg=NULL,xlim=c(-35,35),ylim=c(-35,35)) > abline(h=0,v=0) > > plot(graph2$yod,graph2$xod,data=graph2) > dfx = data.frame(ev1=graph2$xod, ev2=graph2$yod, ev3=abs(graph2$dif)) > lines(symbols(x=dfx$ev1, y=dfx$ev2, circles=dfx$ev3,inches=1/8, ann=F, > bg="blue", fg=NULL,xlim=c(-35,35),ylim=c(-35,35))) > abline(h=0,v=0) > > Best, > Bibek-- Sarah Goslee http://www.functionaldiversity.org
The plots did not arrive. The R-help list is fussy about what it allows to go through. Actually the best way of doing things is to use dput() to provide sample data. See https://github.com/hadley/devtools/wiki/Reproducibility or http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example To answer your question probably you want to have a look a "mfcol" or "mfrow" under ?par. John Kane Kingston ON Canada> -----Original Message----- > From: mbhpathak at gmail.com > Sent: Tue, 17 Dec 2013 09:33:30 -0800 > To: r-help at r-project.org > Subject: [R] Hello R user! > > Hello R user, > > I have created two plots (attached!) using the codes below > and would like to merge these figures in one. any suggestions are highly > appreciated! > Thanks, > > plot(graph1$yod,graph1$xod,data=graph1) > dfx = data.frame(ev1=graph1$xod, ev2=graph1$yod, ev3=abs(graph1$dif)) > symbols(x=dfx$ev1, y=dfx$ev2, circles=dfx$ev3,inches=1/8, ann=F, > bg="black", fg=NULL,xlim=c(-35,35),ylim=c(-35,35)) > abline(h=0,v=0) > > plot(graph2$yod,graph2$xod,data=graph2) > dfx = data.frame(ev1=graph2$xod, ev2=graph2$yod, ev3=abs(graph2$dif)) > lines(symbols(x=dfx$ev1, y=dfx$ev2, circles=dfx$ev3,inches=1/8, ann=F, > bg="blue", fg=NULL,xlim=c(-35,35),ylim=c(-35,35))) > abline(h=0,v=0) > > Best, > Bibek > ______________________________________________ > R-help at 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.____________________________________________________________ FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family! Visit http://www.inbox.com/photosharing to find out more!
What do you mean by "merge" them into one? Make both graphs appear on the same page of a document? Make a single figure containing both graphs? Plot data from both dataframes on the same set of axes? --Chris Ryan On Tue, Dec 17, 2013 at 12:33 PM, bibek sharma <mbhpathak at gmail.com> wrote:> Hello R user, > > I have created two plots (attached!) using the codes below > and would like to merge these figures in one. any suggestions are highly > appreciated! > Thanks, > > plot(graph1$yod,graph1$xod,data=graph1) > dfx = data.frame(ev1=graph1$xod, ev2=graph1$yod, ev3=abs(graph1$dif)) > symbols(x=dfx$ev1, y=dfx$ev2, circles=dfx$ev3,inches=1/8, ann=F, > bg="black", fg=NULL,xlim=c(-35,35),ylim=c(-35,35)) > abline(h=0,v=0) > > plot(graph2$yod,graph2$xod,data=graph2) > dfx = data.frame(ev1=graph2$xod, ev2=graph2$yod, ev3=abs(graph2$dif)) > lines(symbols(x=dfx$ev1, y=dfx$ev2, circles=dfx$ev3,inches=1/8, ann=F, > bg="blue", fg=NULL,xlim=c(-35,35),ylim=c(-35,35))) > abline(h=0,v=0) > > Best, > Bibek > > ______________________________________________ > R-help at 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. >
On Tue, Dec 17, 2013 at 1:04 PM, bibek sharma <mbhpathak at gmail.com> wrote:> Hi Sarah, > It is not about mfrow or mfcol. I would like to see both sets of data in > one figure. > All I want was combining these two plots to one. > Any suggestions? > BibekSuggestions? Yes. Read the link I and others provided about reproducible questions. Then there's the suggestion I already provided, using points() or lines() to add more data, possibly with xlim or ylim specified (see ?par for details). Without a reproducible example, I can't give specific details.> Also, size of the circle in the plots represents rates and so should be > shown in different sizes. > I tried using plots and points but this did not give me different sizes.If you want to use base graphics, then cex is what you need (see, you guessed it, ?par). You can pass a vector of sizes for your plotting character. For more sophisticated approaches, you might google "bubble plot R" for ideas. Sarah> > > On Tue, Dec 17, 2013 at 9:45 AM, Sarah Goslee <sarah.goslee at gmail.com> > wrote: >> >> What do you mean by "merge these figures in one"? If you want two >> figures on one page, see ?par - specifically mfrow and mfcol. >> >> If you want both sets of data in one figure, maybe ?points or ?lines >> though I see you're already familiar with at least ?lines. >> >> The list doesn't take most attachments, and you might also take a look at: >> >> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example >> >> Asking intelligible questions is the best strategy for receiving >> intelligible answers. >> >> Sarah >> >> On Tue, Dec 17, 2013 at 12:33 PM, bibek sharma <mbhpathak at gmail.com> >> wrote: >> > Hello R user, >> > >> > I have created two plots (attached!) using the codes below >> > and would like to merge these figures in one. any suggestions are highly >> > appreciated! >> > Thanks, >> > >> > plot(graph1$yod,graph1$xod,data=graph1) >> > dfx = data.frame(ev1=graph1$xod, ev2=graph1$yod, ev3=abs(graph1$dif)) >> > symbols(x=dfx$ev1, y=dfx$ev2, circles=dfx$ev3,inches=1/8, ann=F, >> > bg="black", fg=NULL,xlim=c(-35,35),ylim=c(-35,35)) >> > abline(h=0,v=0) >> > >> > plot(graph2$yod,graph2$xod,data=graph2) >> > dfx = data.frame(ev1=graph2$xod, ev2=graph2$yod, ev3=abs(graph2$dif)) >> > lines(symbols(x=dfx$ev1, y=dfx$ev2, circles=dfx$ev3,inches=1/8, ann=F, >> > bg="blue", fg=NULL,xlim=c(-35,35),ylim=c(-35,35))) >> > abline(h=0,v=0) >> > >> > Best, >> > Bibek >> >>-- Sarah Goslee http://www.functionaldiversity.org
On 12/18/2013 04:33 AM, bibek sharma wrote:> Hello R user, > > I have created two plots (attached!) using the codes below > and would like to merge these figures in one. any suggestions are highly > appreciated! > Thanks, > > plot(graph1$yod,graph1$xod,data=graph1) > dfx = data.frame(ev1=graph1$xod, ev2=graph1$yod, ev3=abs(graph1$dif)) > symbols(x=dfx$ev1, y=dfx$ev2, circles=dfx$ev3,inches=1/8, ann=F, > bg="black", fg=NULL,xlim=c(-35,35),ylim=c(-35,35)) > abline(h=0,v=0) > > plot(graph2$yod,graph2$xod,data=graph2) > dfx = data.frame(ev1=graph2$xod, ev2=graph2$yod, ev3=abs(graph2$dif)) > lines(symbols(x=dfx$ev1, y=dfx$ev2, circles=dfx$ev3,inches=1/8, ann=F, > bg="blue", fg=NULL,xlim=c(-35,35),ylim=c(-35,35))) > abline(h=0,v=0) >Hi Bibek, From what I can guess of the above, you might be interested in the size_n_color plot (plotrix). Jim