I wonder how to draw such path diagrams with minimal effort.

|
|
Here is another solution using TiKZ is an awesome package for making diagrams. Because you do it programmatically rather than interactively, you can make images very precisely, and with higher-level concepts; but it involves some forethought if you want to do it quickly. I will describe the workflow, in order to describe not just what code would produce this image, but to indicate how you can go about designing code to produce this image. Obligatory pre-ambleUse something like this at the beginning of your document.
The command Defining stylesYour picture has several nodes (boxes, ellipses) with common features. We define different styles of nodes which more-or-less duplicate them. You should name them more intelligently than I have. All of these are settings which describe how they ought to look. (The "
There are also different kinds of arrows which are repeated: we define styles for those as well. (Here, "
Ad-hoc commandsSome of your nodes have features such as labels with multiple lines. We're going to make a macro to produce those labels nicely. The default width of
In order to more quickly prototype the image, I want fast control over the spacing of the nodes vertically, which is where there is the most variation (and the most non-uniformity). I will define a scaling factor that I can adjust for this (set to a negative number, to change the normal
Building the pictureHere we go:
The scale was found by trial-and-error to get it to fit on a single page. You can also independently control the x-scaling and y-scaling, but I didn't do it that way, because I wanted to reverse the directions for co-ordinates anyway, and could do the scaling another way. (You can do this with a negative y-scaling, but then it messes up with the corners of the nodes, such as While you're building this, you should be re-compiling all the time to find out whether your placement is working well, and to adjust the styles of the nodes to make their appearance work better. But don't spend too much time making everything perfect; get things just almost-right first, and then make them perfect at the end. Building the E nodesThese are the nodes with E labels on the left and right. We will give them names so that we can refer to the nodes when drawing arrows. I eye-balled the relative vertical spacing of the nodes; wherever there was a larger gap, I settled on an incremental spacing of
The Building the V nodesThese are the nodes with V labels, which will be the names of the nodes. They also have separate titles, which are the Axxx#-style part of their printed labels. They have similar vertical positioning as the input nodes. We produce their labels using the
We use the V# part of the label to name the nodes, because it's shorter, and because they match up with the names of the neighboring E nodes; this will be convenient later. Building the F nodesThese are the elliptical nodes with the F labels. This is again similar to the V nodes. Their vertical positioning is basically at the gaps of the V nodes; this was computed by hand, though if you were slightly fancier you could have
Building the D nodesFor each of the F nodes on the right-hand side, there is a D node above and to the right. We place a D node for each one at a fixed position relative to the corresponding F node.
If you were to end the picture here by adding
Arrow drawingHere, we take advantage of the labelling scheme for the nodes. In this case, because the labels are fairly uniform throughout the diagram, we basically just need to say "connect each E node with the appropriate V node", and similarly for the D nodes to the F nodes (with the appropriate style of arrow).
The V and F nodes don't have such a simple naming scheme, but that's okay; we just specify the full node names. Also, we would like the arrows to terminate precisely at the middle of the vertical sides of the boxes; we do this by specifying the "
The most complicated arrow to do in the diagram is between F1 and F3; we want this arrow to be anchored precisely at the centre-right, and to curve. We can do this by specifying the "
The other arrows are fairly simple, and use the techniques described thus far.
Finishing upAnd that's it!
The resulting figure:
It's a pretty faithful representation of the original, if I so say so myself; And I made it in one hour, starting from nothing but the original to go by — some of which was spent looking up forgotten bits of TiKZ as I went! |
|||||||||||||
|
|
Look at the second tutorial in the TikZ manual: it's titeled "A Petri-Net For Hagen", if you work through the example you'll be able to do something like this with ease:
|
|||
|
|