Skip to content

vertical semi-circles in R

4 messages · Eliza B, Rui Barradas, Jim Lemon

#
Dear useRs,


I am to teach my students some drawing techniques in R. I started shape of an handle by using the following codes;
The coding will draw a section of a handle. Now I want to draw semi circles of radius 0.05 between (0,0.6) and (0,0.1), oriented vertically and outward with mouth facing against the y-axis.

I tried every help available online but to no use.

Thanks in advance,

EB
#
Hello,

I'm not the greatest graphics programmer but is this it?

#install.packages("shape")

library(shape)  # for function plotcircle

plot(0,0,col="white")
segments(0,0,0.3,0.3)
segments(0.3,0.4,0.3,0.3)
segments(0.3,0.4,0,0.7)
segments(0,0.7,0,0.6)
segments(0,0.0,0,0.1)

plotcircle(r = 0.25, mid = c(0,0.35), from = pi/2, to = -pi/2)


Note: you say you've tried every online help with no success. I had 
never used package shape, at an R prompt I typed

 > ?circle
No documentation for ?circle? in specified packages and libraries:
you could try ???circle?

so I tried ??circle and found the package. The rest took me less than 10 
minutes. (Less than 5?)

Hope this helps,

Rui Barradas

Em 25-06-2017 12:34, Eliza B escreveu:
#
I forgot to mention that a circle with radius 0.05 cannot go from 
(0,0.6) to (0,0.1), that's why I've changed the radius to 0.25, half the 
distance between those points. I also chose the center point.

Rui Barradas

Em 25-06-2017 19:45, Rui Barradas escreveu:
#
Hi Eliza,
How about this:

library(plotrix)
plot(0,type="n")
draw.arc(rep(0,6),seq(0.1,0.6,by=0.1),radius=0.05,
 angle1=3*pi/2,angle2=5*pi/2)

Jim
On Sun, Jun 25, 2017 at 9:34 PM, Eliza B <eliza_botto1 at outlook.com> wrote: