Created
April 9, 2020 09:25
-
-
Save hadrienj/920c5d0f0babcd66f9a5eb4fb3490e1a to your computer and use it in GitHub Desktop.
Plot unit vectors
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
# choose figure size | |
plt.figure(figsize=(6, 6)) | |
# Assure that ticks are displayed with a step equal to 1 | |
ax = plt.gca() | |
ax.xaxis.set_major_locator(ticker.MultipleLocator(1)) | |
ax.yaxis.set_major_locator(ticker.MultipleLocator(1)) | |
# draw axes | |
plt.axhline(0, c='#A9A9A9', zorder=0) | |
plt.axvline(0, c='#A9A9A9', zorder=0) | |
ax.quiver(0, 0, 0, 1, color="#2EBCE7", angles='xy', scale_units='xy', scale=1) | |
plt.text(-0.3, 0.5, r'$\vec{j}$', color="#2EBCE7", size=18) | |
ax.quiver(0, 0, 1, 0, color="#00E64E", angles='xy', scale_units='xy', scale=1) | |
plt.text(0.4, -0.4, r'$\vec{i}$', color="#00E64E", size=18) | |
plt.xlim(-1, 3) | |
plt.ylim(-1, 3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment