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

Rolf Turner rolf.turner at xtra.co.nz
Wed Mar 28 11:06:18 CEST 2012


On 28/03/12 15:49, alan wrote:
> I want to plot many points and want to use circles. The filling color
> depends on variable a. if a=1, then not fill
> if a=2 then fill with red, if a=3 then fill with blue, if a=4, fill
> half with red and half with blue. Can anyone tell me how to plot the
> case "a=4"? Thanks a lot

I could be wrong --- this was known to happen once :-) --- but I
strongly doubt that there is anything ``off the peg'' that will do
what you want.  You'll have to roll your own.  I'd suggest
looking at the draw.circle() function from the plotrix package
for some ideas on how to get started.

It seems to me that for each such circle you'll have to plot
two polygons --- one for each half of the circle --- and specify
fill="red" for one and fill="blue" for the other.

It's all do-able, but is it worth the effort?  Why not fill with
green (say) when a=4?

     cheers,

         Rolf Turner



More information about the R-help mailing list