iT邦幫忙

0

matplotlib繪圖問題

data如下:

from_x,from_y,to_x,to_y
2,3,3.5,5
1,4,3,7
4,6,6,3
3,3,3.2,5
4,5,7,5

我想要繪出這樣的圖
圖
目前我只會用笨方法處理

import numpy as np
import matplotlib.pyplot as plt
t11 = [2, 3.5]
t12 = [3, 5]

t21 = [1, 3]
t22 = [4, 7]

t31 = [4, 6 ]
t32 = [6, 3]

t41 = [3, 3.2]
t42 = [3, 5]

t51 = [4, 7]
t52 = [5 ,5]
plt.plot(t11, t12, 'y', t21, t22, 'b', 
         t31, t32, 'g', t41, t42, 'r',
         t51, t52)

plt.show()

不知道大大是否有比較好的處理方式,麻煩各位了

尚未有邦友回答

立即登入回答