Last active
August 29, 2015 14:12
-
-
Save alyssaq/90d5f116250c443cd928 to your computer and use it in GitHub Desktop.
Identity matrix linear transformations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
ax = plt.axes() | |
ax.arrow(0, 0, 1, 0, head_width=0.05, head_length=0.1, fc='k', ec='k', zorder=20) | |
ax.arrow(0, 0, 0, 1, head_width=0.05, head_length=0.1, fc='k', ec='k', zorder=20) | |
ax.arrow(0, 0, np.cos(np.deg2rad(-30)), np.sin(np.deg2rad(-30)), head_width=0.05, head_length=0.1, fc='r', ec='r', zorder=10) | |
ax.arrow(0, 0, -np.sin(np.deg2rad(-30)), np.cos(np.deg2rad(-30)), head_width=0.05, head_length=0.1, fc='r', ec='r', zorder=10) | |
ax.spines['left'].set_position('zero') | |
ax.spines['right'].set_color('none') | |
ax.spines['bottom'].set_position('zero') | |
ax.spines['top'].set_color('none') | |
ax.xaxis.set_ticks_position('bottom') | |
ax.yaxis.set_ticks_position('left') | |
ax.set_aspect('equal') | |
plt.ylim([-0.7,1.2]) | |
plt.xlim([-0.1,1.2]) | |
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
ax = plt.axes() | |
ax.arrow(0, 0, 1, 0, head_width=0.05, head_length=0.1, fc='k', ec='k', zorder=20) | |
ax.arrow(0, 0, 0, 1, head_width=0.05, head_length=0.1, fc='k', ec='k', zorder=20) | |
ax.arrow(0, 0, 2, 0, head_width=0.05, head_length=0.1, fc='r', ec='r', zorder=10) | |
ax.arrow(0, 0, 0, 2, head_width=0.05, head_length=0.1, fc='r', ec='r', zorder=10) | |
ax.spines['left'].set_position('zero') | |
ax.spines['right'].set_color('none') | |
ax.spines['bottom'].set_position('zero') | |
ax.spines['top'].set_color('none') | |
ax.xaxis.set_ticks_position('bottom') | |
ax.yaxis.set_ticks_position('left') | |
ax.set_aspect('equal') | |
plt.ylim([-0.1,2.2]) | |
plt.xlim([-0.1,2.2]) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment