python - 我需要帮助在 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
解决方案
推荐阅读
- angular - 如何将 ngFor 中的项目限制为 div 中的某个数字,然后在 Angular 中重复?
- scala - Akka-HTTP:如何知道是否在收到的响应中明确设置了 Content-type 标头
- c# - .Net Core 3.1 MVC Ajax 文件上传(不使用表单对象)
- javascript - React Native SVG图像未加载
- sas - PROC SQL: CASE WHEN EXPRESSION - WHEN 子句 2 的结果与上述结果的数据类型不同
- sql - 如何在数据库中创建关系
- python - 有没有办法在某个列上获取日期差异
- php - 过滤子阵列的最干净和最快的方法
- c++ - 想在向量中添加所有 i,然后打印最大值
- html - R 编程,网页抓取-我无法从 html 获取链接