79501300

Date: 2025-03-11 15:40:36
Score: 1
Natty:
Report link

I have tried to print a graph. Here´s my solution:

import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Arc

# Calculating the angle in radians
club_path = np.radians(5.89)  # Club Path
face_angle = np.radians(3.12)  # Face Angle

# Create a figure and an axis
fig, ax = plt.subplots()

# Axis limits
ax.set_xlim(-1, 1)
ax.set_ylim(-1, 1)

# Draw x- and y-axis
ax.axhline(0, color='black', linewidth=0.5, ls='--')
ax.axvline(0, color='black', linewidth=1.5, ls='--')

# Draw angles
club_vector = np.array([np.sin(club_path), np.cos(club_path)])
face_vector = np.array([np.sin(face_angle), np.cos(face_angle)])

ax.quiver(0, 0, club_vector[0], club_vector[1], angles='xy', scale_units='xy', scale=1, color='blue', label='Club Path (5.89°)')
ax.quiver(0, 0, face_vector[0], face_vector[1], angles='xy', scale_units='xy', scale=1, color='orange', label='Face Angle (3.12°)')

# Calculte angle between the to vectors
dot_product = np.dot(club_vector, face_vector)
norm_club = np.linalg.norm(club_vector)
norm_face = np.linalg.norm(face_vector)

# Calculating the angle in radians
angle_radians = np.arccos(dot_product / (norm_club * norm_face))
angle_degrees = np.degrees(angle_radians)

# Add angle in ledgend
ax.legend(title=f"Face to Path: {angle_degrees:.2f}°")

# Delete diagram frame
for spine in ax.spines.values():
    spine.set_visible(False)

# Delete x- and y-axis
ax.set_xticks([])
ax.set_yticks([])

# Print diagram
plt.show()

The plot looks like this:

enter image description here

Does anybody now how to extend the Arrow like this:

enter image description here

And does anybody now how I make a table which is clickable and the row is shown in the plot?

Thanks

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Whitelisted phrase (-2): solution:
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: 0x53olution