[R] layer plots.
Hello. I have 2 plots. plot1 -plot(table1) plot2 -plot(table2) How may i plot these both on the same graph, i.e. layer one graph on top of the other one. The result should look similar to this the image below, where the black lines indicate one plot, and the red dots indicate the second plot. http://r.789695.n4.nabble.com/file/n4459732/R_screen_shot.png Aaral. -- View this message in context: http://r.789695.n4.nabble.com/layer-plots-tp4459732p4459732.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] layer plots.
No idea what table1, table2 are plot(1:5, type = l) points(5:1, col = 2) should get you started. Michael On Fri, Mar 9, 2012 at 10:17 AM, aaral singh aaral.si...@gmail.com wrote: Hello. I have 2 plots. plot1 -plot(table1) plot2 -plot(table2) How may i plot these both on the same graph, i.e. layer one graph on top of the other one. The result should look similar to this the image below, where the black lines indicate one plot, and the red dots indicate the second plot. http://r.789695.n4.nabble.com/file/n4459732/R_screen_shot.png Aaral. -- View this message in context: http://r.789695.n4.nabble.com/layer-plots-tp4459732p4459732.html Sent from the R help mailing list archive at Nabble.com. __ 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. __ 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.
Re: [R] layer plots.
Many thanks for reply. I have trouble understanding how to use response, i am sorry. My question is i have two matrices. I then plot two matrices. Then I have 2 seperate plots. I can color the nodes in the plots in two different colors. Then, how do i merge the two plots to view one overlapping the other? i.e. to view two sets of data in one 2D space? Many thanks On Fri, Mar 9, 2012 at 3:51 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: No idea what table1, table2 are plot(1:5, type = l) points(5:1, col = 2) should get you started. Michael On Fri, Mar 9, 2012 at 10:17 AM, aaral singh aaral.si...@gmail.com wrote: Hello. I have 2 plots. plot1 -plot(table1) plot2 -plot(table2) How may i plot these both on the same graph, i.e. layer one graph on top of the other one. The result should look similar to this the image below, where the black lines indicate one plot, and the red dots indicate the second plot. http://r.789695.n4.nabble.com/file/n4459732/R_screen_shot.png Aaral. -- View this message in context: http://r.789695.n4.nabble.com/layer-plots-tp4459732p4459732.html Sent from the R help mailing list archive at Nabble.com. __ 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. __ 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. [[alternative HTML version deleted]] __ 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.
Re: [R] layer plots.
Do your matrices match up with each other in any meaningful way or do you just want two independent plots on a single page? You should probably provide the dput() output of each table object so we can see what you've got. Michael On Fri, Mar 9, 2012 at 11:07 AM, aoife doherty aaral.si...@gmail.com wrote: Many thanks for reply. I have trouble understanding how to use response, i am sorry. My question is i have two matrices. I then plot two matrices. Then I have 2 seperate plots. I can color the nodes in the plots in two different colors. Then, how do i merge the two plots to view one overlapping the other? i.e. to view two sets of data in one 2D space? Many thanks On Fri, Mar 9, 2012 at 3:51 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: No idea what table1, table2 are plot(1:5, type = l) points(5:1, col = 2) should get you started. Michael On Fri, Mar 9, 2012 at 10:17 AM, aaral singh aaral.si...@gmail.com wrote: Hello. I have 2 plots. plot1 -plot(table1) plot2 -plot(table2) How may i plot these both on the same graph, i.e. layer one graph on top of the other one. The result should look similar to this the image below, where the black lines indicate one plot, and the red dots indicate the second plot. http://r.789695.n4.nabble.com/file/n4459732/R_screen_shot.png Aaral. -- View this message in context: http://r.789695.n4.nabble.com/layer-plots-tp4459732p4459732.html Sent from the R help mailing list archive at Nabble.com. __ 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. __ 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. __ 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.
Re: [R] layer plots.
The response much appreciated. They do match up, one is a small subset of the other. I have this: dput(table1) structure(list(var1 = c(2L, 4L, 4L, 1L, 423L), var2 = c(3L, 5L, 6L, 342L, 3L)), .Names = c(var1, var2), class = data.frame, row.names = c(node1, node2, node3, node4, node5)) dput(list1) structure(list(node = c(node1, node2)), .Names = node) so one table is a 2 X 5 matrix (called table1) and one table is 1 X 2 table (called list1). i then type this: plot1 -plot(table,suprow=c(list1$node),passive) to give me a plot of list1 and this: plot2 -plot(table,suprow=c(list1$node),active) to give me a plot of table1 i want to combine plot 1 and 2. BUT i know i can do this: plot2 -plot(table,suprow=c(list1$node),all) to plot both on the same graph, but in my actual dataset, the points in list1 are obscured from sight by table1, because in reality table 1 may contain 20,000 points and list1 may contain 10 points, so i cannot see where my 10 specific nodes of interest are on the graph. So i want to plot the graph so that any nodes in list1 are seen on top of the plot of table 1. On Fri, Mar 9, 2012 at 5:36 PM, Michael Weylandt [via R] ml-node+s789695n4460118...@n4.nabble.com wrote: Do your matrices match up with each other in any meaningful way or do you just want two independent plots on a single page? You should probably provide the dput() output of each table object so we can see what you've got. Michael On Fri, Mar 9, 2012 at 11:07 AM, aoife doherty [hidden email]http://user/SendEmail.jtp?type=nodenode=4460118i=0 wrote: Many thanks for reply. I have trouble understanding how to use response, i am sorry. My question is i have two matrices. I then plot two matrices. Then I have 2 seperate plots. I can color the nodes in the plots in two different colors. Then, how do i merge the two plots to view one overlapping the other? i.e. to view two sets of data in one 2D space? Many thanks On Fri, Mar 9, 2012 at 3:51 PM, R. Michael Weylandt [hidden email] http://user/SendEmail.jtp?type=nodenode=4460118i=1 wrote: No idea what table1, table2 are plot(1:5, type = l) points(5:1, col = 2) should get you started. Michael On Fri, Mar 9, 2012 at 10:17 AM, aaral singh [hidden email]http://user/SendEmail.jtp?type=nodenode=4460118i=2 wrote: Hello. I have 2 plots. plot1 -plot(table1) plot2 -plot(table2) How may i plot these both on the same graph, i.e. layer one graph on top of the other one. The result should look similar to this the image below, where the black lines indicate one plot, and the red dots indicate the second plot. http://r.789695.n4.nabble.com/file/n4459732/R_screen_shot.png Aaral. -- View this message in context: http://r.789695.n4.nabble.com/layer-plots-tp4459732p4459732.html Sent from the R help mailing list archive at Nabble.com. __ [hidden email] http://user/SendEmail.jtp?type=nodenode=4460118i=3mailing 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. __ [hidden email] http://user/SendEmail.jtp?type=nodenode=4460118i=4mailing 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. __ [hidden email] http://user/SendEmail.jtp?type=nodenode=4460118i=5mailing 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. -- If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/layer-plots-tp4459732p4460118.html To unsubscribe from layer plots., click herehttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4459732code=YWFyYWwuc2luZ2hAZ21haWwuY29tfDQ0NTk3MzJ8LTE5NjQxNjQyNTM= . NAMLhttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://r.789695.n4.nabble.com/layer-plots-tp4459732p4460207.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list
Re: [R] layer plots.
It's hard to help if you keep changing the framework of your problem, first two matrices - now it's a data.frame and a list of subset row names in a plotting method from whatever package suprow comes from. Regardless, Michael's original answer already gave you a solution: plot(table1,type='l',lwd=2) points(table1[list1$node,],col=2,pch=19) The points are overlayed on the line plot, so they are not obscured if you have 20 or 20M values. On Fri, Mar 9, 2012 at 11:09 AM, aaral singh aaral.si...@gmail.com wrote: The response much appreciated. They do match up, one is a small subset of the other. I have this: dput(table1) structure(list(var1 = c(2L, 4L, 4L, 1L, 423L), var2 = c(3L, 5L, 6L, 342L, 3L)), .Names = c(var1, var2), class = data.frame, row.names = c(node1, node2, node3, node4, node5)) dput(list1) structure(list(node = c(node1, node2)), .Names = node) so one table is a 2 X 5 matrix (called table1) and one table is 1 X 2 table (called list1). i then type this: plot1 -plot(table,suprow=c(list1$node),passive) to give me a plot of list1 and this: plot2 -plot(table,suprow=c(list1$node),active) to give me a plot of table1 i want to combine plot 1 and 2. BUT i know i can do this: plot2 -plot(table,suprow=c(list1$node),all) to plot both on the same graph, but in my actual dataset, the points in list1 are obscured from sight by table1, because in reality table 1 may contain 20,000 points and list1 may contain 10 points, so i cannot see where my 10 specific nodes of interest are on the graph. So i want to plot the graph so that any nodes in list1 are seen on top of the plot of table 1. On Fri, Mar 9, 2012 at 5:36 PM, Michael Weylandt [via R] ml-node+s789695n4460118...@n4.nabble.com wrote: Do your matrices match up with each other in any meaningful way or do you just want two independent plots on a single page? You should probably provide the dput() output of each table object so we can see what you've got. Michael On Fri, Mar 9, 2012 at 11:07 AM, aoife doherty [hidden email]http://user/SendEmail.jtp?type=nodenode=4460118i=0 wrote: Many thanks for reply. I have trouble understanding how to use response, i am sorry. My question is i have two matrices. I then plot two matrices. Then I have 2 seperate plots. I can color the nodes in the plots in two different colors. Then, how do i merge the two plots to view one overlapping the other? i.e. to view two sets of data in one 2D space? Many thanks On Fri, Mar 9, 2012 at 3:51 PM, R. Michael Weylandt [hidden email] http://user/SendEmail.jtp?type=nodenode=4460118i=1 wrote: No idea what table1, table2 are plot(1:5, type = l) points(5:1, col = 2) should get you started. Michael On Fri, Mar 9, 2012 at 10:17 AM, aaral singh [hidden email]http://user/SendEmail.jtp?type=nodenode=4460118i=2 wrote: Hello. I have 2 plots. plot1 -plot(table1) plot2 -plot(table2) How may i plot these both on the same graph, i.e. layer one graph on top of the other one. The result should look similar to this the image below, where the black lines indicate one plot, and the red dots indicate the second plot. http://r.789695.n4.nabble.com/file/n4459732/R_screen_shot.png Aaral. -- View this message in context: http://r.789695.n4.nabble.com/layer-plots-tp4459732p4459732.html Sent from the R help mailing list archive at Nabble.com. __ [hidden email] http://user/SendEmail.jtp?type=nodenode=4460118i=3mailing 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. __ [hidden email] http://user/SendEmail.jtp?type=nodenode=4460118i=4mailing 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. __ [hidden email] http://user/SendEmail.jtp?type=nodenode=4460118i=5mailing 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. -- If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/layer-plots-tp4459732p4460118.html To unsubscribe from layer plots., click herehttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4459732code=YWFyYWwuc2luZ2hAZ21haWwuY29tfDQ0NTk3MzJ8LTE5NjQxNjQyNTM= .