# How to Plot Cycloid with Plots?

Hi all,

I want to plot the cycloid, with PartialCircle, I think it is not working…

Here is my code / MWE:

using Plots, LaTeXStrings; gr()

# To plot a circle of radius 2 centered at (0, 0)
θ = 0:0.01:2π
x = 0 .+ 2cos.(θ)
y = 0 .+ 2sin.(θ)
plot(x, y, xlims=(-3,3), label="")

scatter!([0], [0], color = "red1", label="", markersize = 3)
scatter!([0 + 2cos(1.2π)], [0 + 2sin(1.2π)], color = "red1", label="", markersize = 3)

plot!(Plots.partialcircle(0.5,1//2*pi,100,-0.2), label="",color=:blue, arrow=true)
plot!(Plots.partialcircle(0.5,1.2*pi,100,1.9), label="",color=:blue,
linestyle=:dash, arrow=false)

plot!([0,0 + 2cos(1.2π)],[0,0 + 2sin(1.2π)], label="", linecolor=:green)
plot!([0,0],[0,-1.17], label="", linecolor=:green)
plot!([0,0 + 2cos(1.2π)],[-1.17,0 + 2sin(1.2π)], label="", linecolor=:green)
plot!([0,0],[-1.17,-2.17], label="", linecolor=:green, linestyle=:dash)

annotate!([(-0.19,-0.3, (L"\theta", 10, :blue))])



It is very laughable

After thinking and tinkering I get this:

using Plots, LaTeXStrings; gr()

# To plot a circle of radius 2 centered at (0, 0)
θ = 0:0.01:2π
x = 0 .+ 2cos.(θ)
y = 0 .+ 2sin.(θ)

plot(x, y, xlims=(-3,3), label="")

# Plot a cycloid
θc = -0.3:0.1:1.1π
xc = θc .- sin.(θc) .- 1.83
yc = -0.3 .- 2cos.(θc)
plot!(xc, yc,
label=L"(x,y) = (t - \sin \ t , -0.3 - 2\cos \ t)",
linestyle=:dash)

scatter!([0], [0], color = "red1", label="", markersize = 3)
scatter!([0 + 2cos(1.2π)], [0 + 2sin(1.2π)], color = "red1", label="", markersize = 3)

plot!(Plots.partialcircle(0.5,1//2*pi,100,-0.2), label="",color=:blue, arrow=true)

plot!([0,0 + 2cos(1.2π)],[0,0 + 2sin(1.2π)], label="", linecolor=:green)
plot!([0,0],[0,-1.17], label="", linecolor=:green)
plot!([0,0 + 2cos(1.2π)],[-1.17,0 + 2sin(1.2π)], label="", linecolor=:green)
plot!([0,0],[-1.17,-2.17], label="", linecolor=:green, linestyle=:dash)

annotate!([(-0.19,-0.3, (L"\theta", 10, :blue))])