How can I get the path vertices of an Ellipse with the axes coordinates and not -1 to 1 coordinates?

50 Views Asked by At

When I try to get the path vertices of an ellipse using Matplotlib the vertices are returned scaled from -1 to 1. I would like to understand what is the suggested way to get the vertices using the axes coordinates system and not the scaled one:

import numpy as np 
import matplotlib.pyplot as plt

fig,ax = plt.subplots()
ell_patch = Ellipse((10, 10), 200, 200, theta*180/np.pi, edgecolor='red', facecolor='none')
ax.add_patch(ell_patch)
ax.set_xlim(-200,200)
ax.set_ylim(-200,200)
ell_patch.get_path().vertices

Note I am using Matplotlib 3.5 and I can't upgrade.

As suggested @Flow:

path = ell_patch.get_path()
transform = ell_patch.get_transform()

# Now apply the transform to the path
newpath = transform.transform_path(path)

However it does not scale properly, the Elipse is bigger...

0

There are 0 best solutions below