How to limit the length of the shown x axes just to the related part with data i.e. from 0 to 360 (== 0 to 12.24) on this plot:
([Bug]: patch circles or corresponding scatters are eccentric · Issue #26461 · matplotlib/matplotlib · GitHub)
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (19.2, 9.6)
perf_num = 20.0
circumL = 12.247274627871128
coord_circum = np.array([0. , 0.3, 8.16484975, 12.24727463, 0.62173624,
4.70416111, 8.78658599, 12.86901086, 1.24347247, 5.32589735,
9.40832222, 13.4907471, 1.86520871, 5.94763358, 10.03005846,
12, 12.7, 12.5, 10.6517947, 14.73421957])
coord_along = np.arange(0, 39, 2)
fig, ax1 = plt.subplots()
ax1.set_aspect("equal", adjustable='box')
ax1.set(xlim=(0, circumL), ylim=(0, 36))
ax1.set_xlabel('Perforation angle (°)', fontsize=12)
ax1.set_ylabel('Distance along hole axis (in)', fontsize=12)
ax1.set_xticks(np.linspace(0, circumL, 7))
ax1.set_xticklabels(np.arange(0, 361, 60))
ax2 = ax1.twiny()
ax2.set_aspect("equal")
ax2.set(xlim=(0, circumL), ylim=(0, 36))
ax2.set_xticks(np.arange(0, int(circumL) + 1, 3))
ax2.set_xlabel('Position around circumference (in)', fontsize=12)
ax2.invert_yaxis()
for i in range(len(coord_circum)):
circle_inner = plt.Circle((coord_circum[i], coord_along[i]), 0.1, fill=True, color='r', lw=1)
ax2.add_patch(circle_inner)
circle_outer = plt.Circle((coord_circum[i], coord_along[i]), 0.4, fill=False, color='r', lw=1)
ax2.add_patch(circle_outer)
plt.show()