Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: issues with GraphPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99363] Re: issues with GraphPlot
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Mon, 4 May 2009 05:58:29 -0400 (EDT)
  • References: <gsuisc$drq$1@smc.vnet.net> <gt0s27$ec8$1@smc.vnet.net>

OK, well here is an improved version:


GraphPlot[
 {{"B" -> "A", "BA"}, {"A" -> "B", "AB"}, {"A" -> "C",
   "AC"}, {"C" -> "A", "CA"}, {"B" -> "C", "BC"}, {"C" -> "B", "CB"}},
 DirectedEdges -> True,
 VertexLabeling -> True,
 VertexRenderingFunction -> ({White, EdgeForm[Black], Disk[#, .05],
     Black, Text[#2, #1]} &), EdgeLabeling -> True,
 EdgeRenderingFunction -> ({If[First[#1][[1]] - Last[#1][[1]] < 0,
      Inset[Text[Style[#3, 18]], Mean[#1], Scaled[{0.5, -0.2}],
       Automatic, Last[#1] - First[#1]],
      Inset[Text[Style[#3, 18]], Mean[#1], Scaled[{0.5, 1.2}],
       Automatic, First[#1] - Last[#1]]], Arrowheads[Large],
     Arrow[#1, 0.07]} &),
 PlotStyle -> Thickness[0.005]
 ]


Cheers -- Sjoerd

On May 1, 11:22 am, ADL <alberto.dilu... at tiscali.it> wrote:
> On my version (7.0 for Microsoft Windows (32-bit) (February 18,
> 2009)), the code proposed by Sjoerd produces an upside-down upper
> label. This can be better seen with:
>
> GraphPlot[{{"B" -> "A", "BA"}, {"A" -> "B", "AB"}},
>  DirectedEdges -> True,
>  VertexLabeling -> True,
>  VertexRenderingFunction -> ({White, EdgeForm[Black], Disk[#, .05],
>      Black, Text[#2, #1]} &),
>  EdgeLabeling -> True,
>  EdgeRenderingFunction -> (
>    {Inset[
>       Text[Style[#3, 18]],
>       Mean[#1],
>       Center,
>       Automatic,
>       First[#1] - Last[#1]
>       ],
>      Arrowheads[Large],
>      Arrow[#1, 0.07]
>      } &),
>  PlotStyle -> Thickness[0.005]
>  ]
>
> In this way, it is may be useful only with mirror-invariant labels,
> like (+), (-), etc.
>
> I do not know how to adjust this.
>
> ADL
>
> On Apr 30, 12:19 pm, "Sjoerd C. de Vries" <sjoerd.c.devr... at gmail.com>
> wrote:
>
> > Hi Sean,
>
> > below is the complete code for the label. Read the Inset doc page for
> > more details on the parameters I used.
>
> > Cheers -- Sjoerd
>
> > GraphPlot[{{"B" -> "A", "+"}, {"A" -> "B", "+"}},
> >  DirectedEdges -> True, VertexLabeling -> True,
> >  VertexRenderingFunction -> ({White, EdgeForm[Black], Disk[#, .05],
> >      Black, Text[#2, #1]} &), EdgeLabeling -> True,
> >  EdgeRenderingFunction -> ({Inset[Text[Style[#3, 16]], Mean[#1], Top,
> >       Automatic, First[#1] - Last[#1]], Arrowheads[Medium],
> >      Arrow[#1, 0.07]} &), PlotStyle -> Thickness[0.005]]



  • Prev by Date: Diffusion Model using NDSolve - Advice needed
  • Next by Date: Re: Re: Ten chess-players...
  • Previous by thread: Re: issues with GraphPlot
  • Next by thread: Re: issues with GraphPlot