Thanks Sacha.

The code works well although, as you alluded, the plates are being drawn
after some positional fine tuning. I was hoping that the plates could come
out automatically as they do in graphviz. Possibly, whenever you get to it,
your package can alleviate that.

Cheers.





On Thu, Aug 1, 2013 at 7:11 AM, Sacha Epskamp <m...@sachaepskamp.com> wrote:

> 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.
>>
>>
>

        [[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.

Reply via email to