How to Plot Arc of a circle with pyplot and Plots?

Hi all, I have created this unit circle, and I want to plot an arc for the circle from point P to point (1,0) using Plots and pyplot. I want to bold the arc.

Here is my code, I believe I might only need to add a line of plot![…]:


using Plots
pyplot()

function circleShape(h, k, r)
     θ = LinRange(0, 2*π, 500)
     h .+ r*sin.(θ), k .+ r*cos.(θ)
end

plot(circleShape(0, 0, 1), seriestype = [:shape,], lw = 0.5,
      c =:blue, linecolor = :black,
      legend = false, fillalpha = 0.2, aspect_ratio = 1, showaxis = false)

f(x) = x

plot!([0], seriestype="vline", color=:green, label="")
plot!([0], seriestype="hline", color=:green, label="")
plot!([0.707106781,0.707106781],[0.707106781,0], linecolor=:green, linestyle=:dash)
plot!(f, linecolor=:green, linestyle=:dash)

annotate!([(1.1,0, ("x", 10, :red)), 
           (0.15,1.03, ("y", 10, :red)), 
           (0.1,-0.1, ("(0,0)", 10, :red)),
           (-0.88,-1, ("y=x", 10, :red)),
           (0.42,0.073, ("x", 10, :red)),
           (0.66,0.33, ("x", 10, :red)),
           (0.37,0.46, ("1", 10, :red)),
           (1.08,-0.08, ("(1,0)", 10, :red)),
           (0.73,0.87, ("P", 10, :red))])

scatter!([1], [0], color = "red", label="", markersize = 5)
scatter!([0.707106781], [0.707106781], color = "red", label="", markersize = 5)


h

You are probably looking for partialcircle:

using Plots
plot(Plots.partialcircle(0,1//3*pi))
2 Likes

Hi BeastyBlacksmith,

this is the solution of one line that I am looking for. Thanks!

1 Like