你好,我有這樣的代碼:
from matplotlib import pyplot as plt
b = 2.8977685 * (10 ** -3)
k_range = [i for i in range(3500, 5500)]
results = [b/i for i in range(3500, 5500)]
plt.plot(results, k_range)
plt.show()

現在我如何繪制 arron 以在 K = 4800 中找到結果
uj5u.com熱心網友回復:
IIUC,這樣的事情?
from matplotlib import pyplot as plt
import numpy as np
b = 2.8977685 * (10 ** -3)
k_range = [i for i in range(3500, 5500)]
results = [b/i for i in range(3500, 5500)]
k = np.array(k_range)
i = np.where(k==4800)
r=np.array(results)
r[i]
plt.plot(results, k_range, marker='x', markevery=[i[0]], markeredgecolor='r')
ax = plt.gcf().gca()
ax.annotate("", xy=(r[i], 4800), xytext=(r[i], 4400), arrowprops=dict(arrowstyle="->"))
plt.show()
輸出:

uj5u.com熱心網友回復:
使用matplotlib.pyplot.arrow():
from matplotlib import pyplot as plt
b = 2.8977685 * (10 ** -3)
k_range = [i for i in range(3500, 5500)]
results = [b/i for i in range(3500, 5500)]
plt.plot(results, k_range)
plt.arrow(6E-7, 4000, 8E-8, 200, ec='red', width = 5E-12, head_width=1E-8)
plt.show()
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/402797.html
標籤:
上一篇:如何從PandasDataFrame中采樣資料,其中給定日期的每個小時都存在資料
下一篇:天線方向圖極坐標圖
