Re: issues with GraphPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg99501] Re: issues with GraphPlot
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Thu, 7 May 2009 06:31:03 -0400 (EDT)
- References: <gsuisc$drq$1@smc.vnet.net> <gt0s27$ec8$1@smc.vnet.net>
Thought I replied to this, but it doesn't appear. So, here it goes
again:
GraphPlot[
{{"B" -> "A", "BA"}, {"A" -> "B", "AB"}, {"A" -> "C",
"AC"}, {"C" -> "A", "CA"}, {"C" -> "B", "CB"}, {"B" -> "C", "BC"}},
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, 16]], Mean[#1], Scaled[{0.5, 1.2}],
Automatic, First[#1] - Last[#1]], Arrowheads[Medium],
Arrow[#1, 0.07]}, {Inset[Text[Style[#3, 16]], Mean[#1],
Scaled[{0.5, -0.2}], Automatic, Last[#1] - First[#1]],
Arrowheads[Medium], 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]]