[Rd] help with R rendering engine
Mark W Kimpel
mwkimpel at gmail.com
Mon Feb 11 05:42:39 CET 2008
Paul and Michael,
Thanks for the information. Yes, it appears that what I want is to be
able to present R with a convex polygon for the clipping path. As I
waited for comments (for some reason Michael's email did not get to me),
I began working on my own methods. I am essentially using a matrix in R
to represent pixel-space and using my own edge-detection algorithm. As I
write this, I believe I am almost there, but testing awaits tomorrow.
The real question will be how fast it actually runs. I'll report back
later this week.
Mark
Mark W. Kimpel MD ** Neuroinformatics ** Dept. of Psychiatry
Indiana University School of Medicine
15032 Hunter Court, Westfield, IN 46074
(317) 490-5129 Work, & Mobile & VoiceMail
(317) 204-4202 Home (no voice mail please)
mwkimpel<at>gmail<dot>com
******************************************************************
Paul Murrell wrote:
> Hi
>
>
> Michael Lawrence wrote:
>> On Feb 7, 2008 4:49 PM, Mark W Kimpel <mwkimpel at gmail.com> wrote:
>>
>>> I'm doing some work on a potential patch to the Bioconductor package
>>> Rgraphviz and have some questions on code that is contained in engine.c.
>>> In particular, I am developing some custom shapes using polygon and need
>>> to make sure that, with rendering, the line connecting the centers of
>>> two polygons stops at the border of each polygon. The polygons can be
>>> transparent, so the option of just rendering the lines first won't work.
>>>
>>> Is there some help for me with an R internal or perhaps a higher level
>>> function?
>>>
>> I have to admit I am not that familiar with R graphics, but a very common
>> way to achieve this in general is to use clipping. That is, you would set
>> the regions covered by your node polygons as the "clip" and then draw your
>> edges. Anything drawn onto the clip region is discarded. You would then
>> reset the clip and continue drawing.
>>
>> I'm pretty sure that base R does not support the complex clip regions you
>> would require. However, it would be possible to do this in R by rendering to
>
>
> That's right. R's graphics engine only copes with rectangular clipping
> regions.
>
> OTOH, the 'grid' package does have a facility to determine locations on
> the edges of objects (see grobX() abnd grobY()). This is not
> fully-featured, but for convex polygons it might give you what you want.
> There's an example or two in
> http://www.stat.auckland.ac.nz/~paul/Talks/rgraphs.pdf
>
> Paul
>
>
>> pixmaps in memory and then compositing the pixmaps. The first part is
>> supported by the cairoDevice package and the latter part by RGtk2 (in
>> particular its binding to GDK). I'm sure you'd rather not introduce such a
>> dependency on Rgraphviz, but it's an option. I think the graphviz developers
>> are moving towards GTK+/Cairo in terms of plugins and other work.
>>
>> I checked libgd (already a dependency of graphviz) but found that it only
>> supports a single rectangle for clipping.
>>
>> Anyway, I hope this helps a little and good luck,
>> Michael
>>
>>
>>> Thanks,
>>> Mark
>>> --
>>>
>>> Mark W. Kimpel MD ** Neuroinformatics ** Dept. of Psychiatry
>>> Indiana University School of Medicine
>>>
>>> 15032 Hunter Court, Westfield, IN 46074
>>>
>>> (317) 490-5129 Work, & Mobile & VoiceMail
>>> (317) 204-4202 Home (no voice mail please)
>>>
>>> mwkimpel<at>gmail<dot>com
>>>
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
More information about the R-devel
mailing list