#%% import matplotlib.pyplot as plt import numpy as np fig, ax = plt.subplots(figsize=(8, 8)) # Vektoren definieren vektoren = { r'$\vec{a}$': (2, 1), r'$S \cdot \vec{a}$': (1, 2), r'$S \cdot (S \cdot \vec{a})$': (0.5, 4) } farben = ['#2196F3', '#FF5722', '#4CAF50'] for (name, wert), farbe in zip(vektoren.items(), farben): ax.annotate('', xy=wert, xytext=(0, 0), arrowprops=dict(arrowstyle='->', lw=2.5, color=farbe)) ax.text(wert[0] * 0.5 + 0.2, wert[1] * 0.5 + 0.2, name, fontsize=13, color=farbe, fontweight='bold') # Achsen und Gitter ax.axhline(0, color='grey', lw=0.5) ax.axvline(0, color='grey', lw=0.5) ax.set_xlim(-0.5, 3) ax.set_ylim(-0.5, 4.5) ax.set_aspect('equal') ax.grid(True, alpha=0.3) ax.set_title('Strecken / Stauchung', fontsize=14) plt.tight_layout() plt.savefig('vektoren.png', dpi=150) plt.show() # %%