Re: LayeredGraphPlot Question
- To: mathgroup at smc.vnet.net
- Subject: [mg105483] Re: [mg105456] LayeredGraphPlot Question
- From: "David Park" <djmpark at comcast.net>
- Date: Fri, 4 Dec 2009 04:34:13 -0500 (EST)
- References: <4784962.1259840166540.JavaMail.root@n11>
Michael, You could use the MultiedgeStyle option to further separate the two Applicant- Inactive edges. sz = 550; t[tx_] = Text[Style[tx, FontSize -> 14]]; LayeredGraphPlot[ {{Applicant -> Student, t["Accepted & Matriculates"]}, {Student -> CMS Only, t["Graduates: Declines Alumni"]}, {Student -> Alumni, t["Joins Alumni Assoc."]}, {Student -> Inactive, t["Drops or is Dismissed"]}, {Applicant -> Inactive, t["Denied Admission"]}, {Applicant -> Inactive, t["Doesn't\n Enroll"]}, {CMS Only -> Inactive, t["6 Month Transcript Access Period Elapses"]}}, MultiedgeStyle -> 0.3, VertexLabeling -> True, ImageSize -> {sz, sz}] You could also use Presentations to custom label most of the edges. You can use Null to suppress a regular label and then add the labels precisely where you wish. I know it is extra work, but if you want the best looking presentation for an audience it may be worth it. Needs["Presentations`Master`"] t[tx_] = Text[Style[tx, FontSize -> 14]]; Draw2D[ {LayeredGraphDraw[ {{Applicant -> Student, Null}, {Student -> CMS Only, Null}, {Student -> Alumni, Null}, {Student -> Inactive, t["Drops or is Dismissed"]}, {Applicant -> Inactive, Null}, {Applicant -> Inactive, Null}, {CMS Only -> Inactive, t["6 Month Transcript Access Period Elapses"]}}, MultiedgeStyle -> 0.2, VertexLabeling -> True], (* Custom edge labeling *) Text[Style["Accepted & Matriculates", 14, Background -> White], {0.1, 2.6}, {1, 0}], Text[Style["Graduates:\nDeclines Alumni", 14, Background -> White], {-0.8, 1.6}, {1, 0}], Text[Style["Joins Alumni\nAssociation", 14, Background -> White], {-0.6, 1.5}, {-1, 0}], Text[Style["Doesn't Enroll", 14, Background -> White], {0.7689, 1.861}], Text[Style["Denied Admission", 14, Background -> White], {1.25, 1.373}]}, PlotRangePadding -> {{.3, .5}, {.1, .1}}, ImageSize -> 550] David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: Michael Greene [mailto:mgreene at csumb.edu] I'm documenting a process flow and thought I'd try my hand at using M to draw the flow diagram. After a bit of jiggling, I arrived at the following: sz = 550; t[tx_] = Text[Style[tx, FontSize -> 14]]; LayeredGraphPlot[{ {Applicant -> Student, t["Accepted & Matriculates"]}, {Student -> CMS Only, t["Graduates: Declines Alumni"]}, {Student -> Alumni, t["Joins Alumni Assoc."]}, {Student -> Inactive, t["Drops or is Dismissed"]}, {Applicant -> Inactive, t["Denied or Declines"]}, {CMS Only -> Inactive, t["6 Month Transcript Access Period Elapses"]}}, VertexLabeling -> True, ImageSize -> {sz, sz}] I had to do some size jiggering to get labels to not step on each other, hence the parametric sizing. The graph showed up in a meeting yesterday and as par for a meeting, someone wanted some changes made to the graph. I started to implement the changes when the colliding labels problem resurfaced. I modified the above by rewording one label and adding another - to wit: sz = 550; t[tx_] = Text[Style[tx, FontSize -> 14]]; LayeredGraphPlot[{ {Applicant -> Student, t["Accepted & Matriculates"]}, {Student -> CMS Only, t["Graduates: Declines Alumni"]}, {Student -> Alumni, t["Joins Alumni Assoc."]}, {Student -> Inactive, t["Drops or is Dismissed"]}, {Applicant -> Inactive, t["Denied Admission"]}, {Applicant -> Inactive, t["Doesn't Enroll"]}, {CMS Only -> Inactive, t["6 Month Transcript Access Period Elapses"]}}, VertexLabeling -> True, ImageSize -> {sz, sz}] How can I modify the Denied Admission and Doesn't Enroll labels so they don't collide without hard coding the label vertices? Is there some way to nudge labels up/down or left/right without knowing where they are in the graph? Thanks, Michael