JaYeFFKaY
JaYeFFKaY

Reputation: 17

How to plot a circle in julia

I am working on an optimization problem in Julia in which I find the 2D Chebyshev center. I can find the optimal solution but I am at a loss on plotting it.

Lets say the center is c = (x1,y1) and I have radius r of the circle. I need to plot the Chebyshev circle at a center of c and radius r inside of the polygon:

here

Upvotes: 0

Views: 2148

Answers (1)

Bogumił Kamiński
Bogumił Kamiński

Reputation: 69899

Looking at your plot you are using PyPlot.jl. In this case this is what you can do:

using PyPlot
x = [0,500,600,300,0,0]
y = [0,0,300,500,500,0]
plot(x,y)
plt.gcf().gca().add_artist(plt.Circle((264.978,264.978), 214.976, fill=false))

The general rule for PyPlot.jl is that you can access methods of Python's objects using a getindex with a Symbol passed as method name.

Upvotes: 3

Related Questions