[Date Index]
[Thread Index]
[Author Index]
Re: Re: Label vertices in Graph to display with
*To*: mathgroup at smc.vnet.net
*Subject*: [mg87310] Re: [mg87276] Re: [mg87213] Label vertices in Graph to display with
*From*: Murray Eisenberg <murray at math.umass.edu>
*Date*: Mon, 7 Apr 2008 05:17:48 -0400 (EDT)
*Organization*: Mathematics & Statistics, Univ. of Mass./Amherst
*References*: <200804040758.CAA03960@smc.vnet.net> <200804061043.GAA14476@smc.vnet.net> <99B7896A-04FB-49CF-AC5F-67B9B7342875@lse.ac.uk>
*Reply-to*: murray at math.umass.edu
The problem was, evidently, that the documentation you cite was too
terse for me to discern quickly what I had to do. Perhaps ONE example
showing how to use specified labels (not part of the original graph
structure) would have helped -- a lot!
J. McKenzie Alexander wrote:
> What was the problem with the documentation? The documentation for
> VertexRenderingFunction has the following as the first entry under "More
> Information":
>
> VertexRenderingFunction->f specifies that each vertex should be rendered
> with the graphics primitives given by f[rk,vk], where rk is the
> coordinate position where the vertex is being placed, and vk is its name.
>
>
> On 6 Apr 2008, at 11:43, Murray Eisenberg wrote:
>
>> At last I figured it out. (And no thanks to the documentation.)
>>
>> Here's a simple example of using non-default vertex labels in a
>> GraphPlot display with a graph created by a GraphPlot function:
>>
>> <<Combinatorica`
>>
>> labels = {"a", "b", "c", "d"};
>> GraphPlot[Wheel[4], Method -> None,
>> VertexRenderingFunction ->
>> ({EdgeForm[{Brown}], Yellow, Disk[#1, 0.05],
>> Black, Text[labels[[#2]], #1]} &),
>> BaseStyle -> {FontSize -> 16}]
>>
>> The "secret" is in the meaning of the slot argument #2 to Text within
>> the VertexRenderingFunction.
>>
>> Murray Eisenberg wrote:
>>> I'm using some Combinatorica functions to create graphs where I do not
>>> specify individually the vertices -- and hence do not individually
>>> specify the vertex labels I want, e.g.:
>>>
>>> g = RotateVertices[Cycle[5], \[Pi]/10]; g = AddEdge[g, {2, 5}];
>>> g = SetGraphOptions[g, VertexLabel -> Characters["abcde"]];
>>>
>>> If I use Combinatorica`ShowGraph, then I'll see the vertex labels:
>>>
>>> ShowGraph[g]
>>>
>>> However, if I use Mathematica 6's kernel function GraphPlot, I don't see
>>> these individual labels, but rather the entire list {a,b,c,d,e} of
>>> labels at each vertex!
>>>
>>> GraphPlot[g,Method->None,VertexRenderingFunction->(Text[#2,#1]&)
>>>
>>> How do I coerce GraphPlot to reproduce the behavior of ShowGraph, so
>>> that it labels the individual vertices with a, b, c, d, e?
>>>
>>> (The interaction between Combintorica's graph-creating functions, on the
>>> one hand, and GraphPlot, on the other hand, remains mysterious and
>>> severely underdocumented for me.
>>>
>>> It seems there's a clear attempt to migrate display of graphs to the
>>> kernel function GraphPlot and thereby discourage use of ShowGraph, yet
>>> in almost everything I've attempted so far, GraphPlot does not so
>>> readily or gracefully reproduce the functionality of Combinatorica'a
>>> ShowGraph. This is most especially the case as it affects relative
>>> newcomers to Mathematica like my students.)
>>
>> --
>> Murray Eisenberg murray at math.umass.edu
>> Mathematics & Statistics Dept.
>> Lederle Graduate Research Tower phone 413 549-1020 (H)
>> University of Massachusetts 413 545-2859 (W)
>> 710 North Pleasant Street fax 413 545-1801
>> Amherst, MA 01003-9305
>>
>
>
>
> Please access the attached hyperlink for an important electronic
> communications disclaimer:
> http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
Prev by Date:
**Re: CreateDialog Pecularity**
Next by Date:
**Import .xlsx files**
Previous by thread:
**Re: Re: Label vertices in Graph to display with GraphPlot**
Next by thread:
**Re: Label vertices in Graph to display with GraphPlot**
| |