# [Matplotlib-users] Arc drawing

Hello i have to draw an arc with matplotlib, i have the following data:

{‘handle’: ‘39D’, ‘owner’: ‘1F’, ‘layer’: ‘AM_0’, ‘center’: Vector(1000.0, -1256.595067376733, 0.0), ‘radius’: 2100.0, ‘start_angle’: 67.75727639121727, ‘end_angle’: 112.2427236087827}
basically i have :
Center of the arc
Starting angle
end angle.
Do you have any suggestion

Regards

Hey Luca,

Matplotllib has an Arc artist:
https://matplotlib.org/3.3.2/api/_as_gen/matplotlib.patches.Arc.html

-Paul

···

On Mon, Nov 2, 2020 at 5:02 AM Luca Bertolotti <luca72.bertolotti@gmail.com> wrote:

Hello i have to draw an arc with matplotlib, i have the following data:

{‘handle’: ‘39D’, ‘owner’: ‘1F’, ‘layer’: ‘AM_0’, ‘center’: Vector(1000.0, -1256.595067376733, 0.0), ‘radius’: 2100.0, ‘start_angle’: 67.75727639121727, ‘end_angle’: 112.2427236087827}
basically i have :
Center of the arc
Starting angle
end angle.
Do you have any suggestion

Regards

Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

Hey Luca,

You’re referencing some variables in your snippet that you haven’t defined, so I can’t really help you troubleshoot that.

Here’s a basic example to get you started:

from matplotlib import pyplot
from matplotlib import patches

fig, ax = pyplot.subplots()

arc = patches.Arc(
xy=(2, 3),
width=5,
height=5,
angle=0,
theta1=45,
theta2=180,
)

ax.set_aspect(‘equal’)
ax.autoscale()

···

On Mon, Nov 2, 2020 at 8:36 AM Luca Bertolotti <luca72.bertolotti@gmail.com> wrote:

Hy Paul
I heve read it but i’m not able to draw it:
The data that i have are:
{‘handle’: ‘39D’, ‘owner’: ‘1F’, ‘layer’: ‘AM_0’, ‘center’: Vector(1000.0, -1256.595067376733, 0.0), ‘radius’: 2100.0, ‘start_angle’: 67.75727639121727, ‘end_angle’: 112.2427236087827}

I have try this:
b = Arc((float(xr), float(yr)), (h, h),0, float(entity.dxf.end_angle), float(entity.dxf.end_angle) , color=‘red’, lw=1)

But i get:
Exception “unhandled TypeError”
can’t multiply sequence by non-int of type ‘float’
File: c:\users\luca\appdata\local\programs\python\python38\lib\site-packages\matplotlib\patches.py, Line: 1427

Can you help me

Bets Regards

Il giorno lun 2 nov 2020 alle ore 17:07 Paul Hobson <pmhobson@gmail.com> ha scritto:

Hey Luca,

Matplotllib has an Arc artist:
https://matplotlib.org/3.3.2/api/_as_gen/matplotlib.patches.Arc.html

-Paul

On Mon, Nov 2, 2020 at 5:02 AM Luca Bertolotti <luca72.bertolotti@gmail.com> wrote:

Hello i have to draw an arc with matplotlib, i have the following data:

{‘handle’: ‘39D’, ‘owner’: ‘1F’, ‘layer’: ‘AM_0’, ‘center’: Vector(1000.0, -1256.595067376733, 0.0), ‘radius’: 2100.0, ‘start_angle’: 67.75727639121727, ‘end_angle’: 112.2427236087827}
basically i have :
Center of the arc
Starting angle
end angle.
Do you have any suggestion

Regards

Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users