[R] plot points using circles filled half in red and half in blue.

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Wed Mar 28 12:54:20 CEST 2012


On Wed, Mar 28, 2012 at 11:02 AM, Eik Vettorazzi <E.Vettorazzi at uke.de> wrote:
> Hi Alan,
> on an UTF-8 locale you can use \u25D6 and \u25D7, but you have to plot
> group a=4 twice.

The problem with that is that by default the two half-circles will be
centred on the point location, so won't join look like a whole circle.
I'm not sure how you can adjust the point precisely to make the two
symbols line up.

If you use another of the unicode symbols with the text() plotting
function you can do it. The symbols are half-coloured, half
transparent so you can overlay them thus:

 > plot(1:10,type="n")
 > text(1:10,1:10,"\u25D0",col="red",cex=4)
 > text(1:10,1:10,"\u25D0",col="blue",srt=180,cex=4)

the only problem is then a slight outline of the second colour.

  I tried to fix that by overplotting a unicode circle (25EF) but that
is slightly larger than the other circles. Your font may vary....

-- 
blog: http://geospaced.blogspot.com/
web: http://www.maths.lancs.ac.uk/~rowlings
web: http://www.rowlingson.com/
twitter: http://twitter.com/geospacedman
pics: http://www.flickr.com/photos/spacedman



More information about the R-help mailing list