# How to Plot Cycloid with Plots?

**URL:** https://discourse.julialang.org/t/how-to-plot-cycloid-with-plots/92909
**Category:** General Usage
**Tags:** plotting
**Created:** [January 13, 2023, 6:24am UTC](https://discourse.julialang.org/t/how-to-plot-cycloid-with-plots/92909 "2023-01-13T06:24:44Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)
#### Post date: [January 13, 2023, 6:24am UTC](https://discourse.julialang.org/t/how-to-plot-cycloid-with-plots/92909/1 "2023-01-13T06:24:45Z")

</div>

Hi all,

I want to plot the cycloid, with `PartialCircle`, I think it is not working…  
 ![Capture d’écran_2023-01-13_13-22-00](https://global.discourse-cdn.com/julialang/original/3X/d/c/dc634ccd035b940a53cad5813b9ef2ebb749a717.png)

Here is my code / MWE:

```julia
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))])

```

![Capture d’écran_2023-01-13_13-22-33](https://global.discourse-cdn.com/julialang/original/3X/3/c/3c627af708c9064d3d1082ccf655f0aad18d693f.png)

It is very laughable

---

<div class="post-metadata">

### Author: ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)
#### Post date: [January 13, 2023, 8:02am UTC](https://discourse.julialang.org/t/how-to-plot-cycloid-with-plots/92909/2 "2023-01-13T08:02:50Z")

</div>

After thinking and tinkering I get this:

```julia
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))])

```

![Capture d’écran_2023-01-13_15-02-16](https://global.discourse-cdn.com/julialang/original/3X/a/4/a479e37fc8e5e25e10942688d038cc50a230ae44.png)
