[R] Micro-point with pch=16?

Boris Steipe boris.steipe at utoronto.ca
Mon Apr 7 18:14:08 CEST 2014

The semantics of R svg output are quite simple. The points (drawn as pch=16) are each in a single <path ... /> element in one line, drawn as two cubic Bezier curves with absolute coordinates (cf. http://www.w3.org/TR/SVG11/paths.html#PathDataCubicBezierCommands).

(example: linebreaks and indents for clarity)
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" 
    M 397.640625 528.933594 
    C 397.640625 532.53125 392.238281 532.53125 392.238281 528.933594 
    C 392.238281 525.332031 397.640625 525.332031 397.640625 528.933594

Every C element specifies a curve going from the last previous point to a next point, subject to two control points. Here, the first point is (397.640625, 528.933594) and the second point is (392.238281, 528.933594). Therefore ((397.640625 + 392.238281)/2, (528.933594 + 528.933594/2)) is the centre of the circle and abs(397.640625 - 392.238281) is its diameter.

You could:
 - encode the range of properties you want in some way in the plot symbol 
   e.g. size as the log of the ratio, or encoding it into the color
 - process the svg file, identify the path elements
 - calculate center and desired size
 - replace the path element of the svg with an appropriate circle 
   (see http://www.w3.org/TR/SVG11/shapes.html#CircleElement)

Perhaps though, since all you want to do is to encode Z distance, applying transparency would achieve a comparable effect (see: ?rgb ).


On 2014-04-07, at 11:00 AM, Андрей Парамонов wrote:

> 07.04.2014 18:53, Boris Steipe пишет:
>> Since you won't be able to see the effect on-screen, how about a little script that post-processes the SVG?
>> B.
> It would be the way-to-go, but I'm not sure how to
> 1) determine which point corresponds to which element in svg file,
> 2) modify those mysterious path elements.
> Probably there is a way to monkey-patch some internal procedure?
> Best wishes,
> Andrey Paramonov
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.

More information about the R-help mailing list