<jupyter_start><jupyter_text>Vector Plots in PhysicsSeems like this should be pretty straight forward but who knows.....  DependenciesThe usual...<jupyter_code>import numpy as np
import matplotlib.pyplot as plt<jupyter_output><empty_output><jupyter_text>ExampleOnce you know what the call for a quiver plot expects it seems like it should be pretty direct....[quiver documentation](https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.quiver.html)```ax.quiver(0,0,1,1, units = 'xy', scale = 1)```  In the previous expression the first pair of arguments is the origin of the vector. The next two are the x and y components repectively.  Then there are the usual \**kwargs options for color and units etc.  ```ax.quiver((0,1), (0,0), (1,0), (1,2.5), units = 'xy', scale = 1)```  In this expression the same system applies but two vectors are being plotted. The first argument is the x value of the origin for the first vector and the x value of the origin for the second vector. The arguments to the quiver call have the same meaning but they can be tuples that quiver interprets sequentially.<jupyter_code>fig, ax = plt.subplots()
#fig = plt.figure()
#ax = fig.add_subplot()
#ax.quiver(0,0,2.4,-3.1,
#          color = "green", 
#          units = 'xy', 
#          scale = 1, 
#          width = .1)
ax.quiver((0,1), (0,0), (1,0), (1,2.3), color = ("red","green"),units = 'xy', scale = 1)
#ax.quiver((0,0), (-2,-3), units = 'xy', scale = 1)
plt.axis('equal')
plt.xticks(range(-5,6))
plt.yticks(range(-5,6))
plt.grid()
plt.show()<jupyter_output><empty_output><jupyter_text>Components of a vectorLet's see if this works...<jupyter_code># vector
vectorcomp = [2.4, 3.3]
vectorlocate = [0.,0.]

# color choices and font size
colorcomp = "red"
colorresult = "green"
plt.rcParams.update({'font.size': 16})

# plot figure
fig1, ax1 = plt.subplots()
ax1.quiver((vectorlocate[0],vectorcomp[0],vectorlocate[0]),
          (vectorlocate[1],vectorlocate[1],vectorlocate[1]),
          (vectorcomp[0], 0, vectorcomp[0]),
          (0.,vectorcomp[1],vectorcomp[1]),
          color = (colorcomp,colorcomp,colorresult), 
          units = 'xy', 
          scale = 1, 
          width = .1)

# locate labels
offset = .5 # this will need to scale depending on problem
xcomp_xlabel = (vectorcomp[0] - vectorlocate[0])/2
xcomp_ylabel = vectorlocate[0]- offset
ycomp_xlabel = vectorcomp[0] + offset
ycomp_ylabel = (vectorcomp[1] - vectorlocate[1])/2
result_xlabel = xcomp_xlabel - offset
result_ylabel = ycomp_ylabel + offset

plt.text(xcomp_xlabel,xcomp_ylabel, "Ax", color = colorcomp)
plt.text(ycomp_xlabel, ycomp_ylabel, "Ay", color = colorcomp)
plt.text(result_xlabel,result_ylabel, "A", color = colorresult)

plt.axis('equal')
plt.xlim(-3,6)
plt.ylim(-3,6)
#plt.xticks(range(-5,6))
#plt.yticks(range(-5,6))
plt.grid()
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15033368458025992, 'fraction_numerical': 0.029504741833508957, 'mean_word_length': 4.333333333333333, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '257678', 'license': 'MIT', 'n_tokens_mistral': 1044, 'n_tokens_neox': 1000, 'n_words': 276, 'path': 'VectorQuiver.ipynb', 'repo_name': 'smithrockmaker/JupyterLabReference', 'size': '2847'}