Here is a way to do it with qgraph. Requires lots of manual placement though. I have been asked before to write a package to do these kind of graphics automatically from R given some model. Might do it eventually :)
library("qgraph") # Placement of nodes: Layout <- matrix(c( 1,1, 2,1, 3,1, 4,1, 3,0),,2,byrow=TRUE) # Graph structure: E <- matrix(c( 1,2, 2,3, 3,4, 5,4),,2,byrow=TRUE) # Labels: Lab <- list(expression(alpha),expression(theta),expression(z),expression(w),expression(beta)) # Colors: Col <- c(rep("white",4),"gray") pdf("Model.pdf",width=6, height = 4) # Open plot: par(mar=c(0,0,0,0)) plot(1,type="n",xlim=c(0.5,5),ylim=c(-1,3)) # add graph: qgraph(E, layout = Layout, labels = Lab, color = Col, plot = FALSE, rescale = FALSE) # Add boxes: rect(1.6,0.4,4.6,2) rect(2.6, 0.6, 4.4, 1.6 ) # Add labels: text(3.1, 1.9, "M") text(3.5, 1.5, "N") dev.off() --- Sacha Epskamp, MSc Department of Psychological Methods University of Amsterdam Weesperplein 4, room 2.05 1018 XA Amsterdam The Netherlands http://www.sachaepskamp.com 2013/7/2 Raghu Naik <naik.ra...@gmail.com> > The image did not come through as pointed out by a list member. I have > attached a pdf image file; the link is > > http://stackoverflow.com/questions/3461931/software-to-draw-graphical-models-in-plate-notation > . > > Cheers. > > Raghu > > > On Tue, Jul 2, 2013 at 9:42 AM, Raghu Naik <naik.ra...@gmail.com> wrote: > > > I am trying to create a directed graph with plate notation (like the one > > shown below) in R. > > > > [image: The output image] > > Could someone direct to me an example code that will get me started. > > > > I could not see any reference to plate notations in igraph, qgraph > > packages though I may be wrong. > > > > The above figure made in graphviz by a poster on stackoverflow. > > > > I am not sure if this can be replicated in Rgraphviz - I was not able to > > get there. > > > > I would appreciate any help. > > > > Thanks. > > > > Raghu > > > > ______________________________________________ > 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. > >
Model.pdf
Description: Adobe PDF document
______________________________________________ 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.