Arc drawing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Arc drawing

Luca Bertolotti
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
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Arc drawing

Paul Hobson-2

On Mon, Nov 2, 2020 at 5:02 AM Luca Bertolotti <[hidden email]> 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
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Arc drawing

Paul Hobson-2
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.add_patch(arc)
ax.set_aspect('equal')
ax.autoscale()

On Mon, Nov 2, 2020 at 8:36 AM Luca Bertolotti <[hidden email]> 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}

 h= float(2* entity.dxf.radius)

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)
                ax.add_patch(b)

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 <[hidden email]> ha scritto:

On Mon, Nov 2, 2020 at 5:02 AM Luca Bertolotti <[hidden email]> 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
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users