user3091668 user3091668 - 2 months ago 7
R Question

Create a half circle instead pyramid in scatterplot

I would like to have a half circle instead a pyramid pattern in a R scatterplot. This is my current code to produce a pyramid:

startx <- 101
endx <- 200

x = seq(from=startx, to=endx, by=1)

inx = length(x)
y1 <- seq(from=1, to=inx, by=2)
y2 <- sort(y1, decreasing = TRUE)
y = c(y1, y2)

plot(x,y)


enter image description here
Some idea to change the dots distribution to represent a half circle instead?

Answer

This should get you going!

startx <- -50
endx <- 50

x = seq(from=startx, to=endx, by=0.1)

y <- sqrt(50^2-x^2)

y <- y * 2

x <- x + 150

plot(x,y)

enter image description here

Comments