Re: how to scale text to a bounding rectangle?

• To: mathgroup at smc.vnet.net
• Subject: [mg110536] Re: how to scale text to a bounding rectangle?
• From: Michael <michael2718 at gmail.com>
• Date: Thu, 24 Jun 2010 04:26:55 -0400 (EDT)

```Hi Helen,

Thanks for pointing me to the VertexRenderingFunction option.  I had
been searching for something like that but I was using the ShowGraph[]
function and did not see that there was a similar function named
GraphPlot[].

Although I will still have to do some tweaking (as I don't want all the
edges to intersect the vertex graphic at a single point) this method
looks like it might be a better way to approach the problem, as it looks
like it will lay out the graph with the extents of the vertexes in mind.

Best Regards,

Michael

On 6/19/2010 4:48 AM, Helen Read wrote:
> On 6/17/2010 2:03 AM, Michael wrote:
>> The problem with both of these solutions is that I need the bounding
>> rectangle to be in a Graphics[] expression because I'm creating several
>> of these text filled boxes at arbitrary offsets.  I'm trying to create
>> something similar to Graph[] (hopefully using it's embedding functions)
>> but instead of vertexes I want to create collections of boxes containing
>> text.  However Mathematica seems to render text independently of the
>> coordinate range of the graphic.  For example, these two expressions
>> produce identical output:
>
> Have you looked at using GraphPlot with a VertexRenderingFunction?
>
> For example:
>
> GraphPlot[{"Hello" ->  "World", "World" ->  "Planet",
>     "World" ->  "Earth", "Hello" ->  "Earth"},
>    VertexRenderingFunction ->  ({White, EdgeForm[{Black, Thick}],
>        Disk[#, {.2, .1}], Black, Text[#2, #1]}&)]
>
> --