首页 > 解决方案 > 我需要帮助在 mathoplib 中绘制 x 和 y,我想拆分以获取 xy 坐标,然后根据列绘制它们

问题描述

我想使用一个组合 x, y 坐标的数组,例如 np.array ([[0,0], [0 -1], [x, y]]),然后将其拆分以获得 x 和 y我可以绘制的坐标。我可以根据第一列(对于 x 坐标)和第二列(对于 y 坐标)进行拆分吗

如果是这样,我将如何去做?谢谢

import numpy as np #import numpy

import matplotlib.pyplot as plt #import matplotlib



x = np.array([0,0,4,0])  #array x on the x axis with co-ordinates

y = np.array([0,3,3,0])#array y on the y axis with co-ordinates



plt.figure()

plt.plot(x, y, 'blue')  #display triangle in blue



plt.show() #show triangle

标签: python

解决方案


推荐阅读