简体   繁体   English

以图形方式表示Python中的数据

[英]Graphically representing data in Python

In Python, I have two 2D arrays with each element of the main arrays containing a smaller array which contains the X and Y positions of two objects (One array for each object) at a moment in time, each array functions as a record of each objects X and Y positions over time. 在Python中,我有两个2D数组,主数组的每个元素都包含一个较小的数组,该数组包含两个对象的X和Y位置(每个对象一个数组),每个数组都作为每个数组的记录。物体X和Y随时间变化。 How can I graphically represent this data?, I would like to be able to later add a third object with its own array or maybe expand this into 3D(this would mean 3 elements for each of the smaller arrays x,y and z), I want to be able to put this data into some graph so I can visually see how it changes over time, any help would be appreciated. 我如何以图形方式表示这些数据?我希望以后能够添加第三个具有自己数组的对象,或者将其扩展为3D(这意味着每个较小的数组x,y和z有3个元素),我希望能够将这些数据放入某个图表中,以便我可以直观地看到它如何随时间变化,任何帮助都将受到赞赏。

I'm stuck, I don't know what to try to represent this data. 我被卡住了,我不知道该尝试代表这些数据。

while time < TotalTime:
    objectACurrentPos = [aXpos, aYpos]
    objectBCurrentPos = [bXpos, bYpos]

    objectAposHistory.append(objectACurrentPos)
    objectBposHistory.append(objectBCurrentPos)

this is the inside of a while loop that will iterate anywhere between 1500 and 15000 times so objectAposHistory and objectBposHistory will be quite large 这是一个while循环的内部,它会在1500到15000次之间迭代,所以objectAposHistory和objectBposHistory会非常大

There are many libraries for data visualization. 有许多用于数据可视化的库。 The most commons ones are probably pandas and matplotlib . 最常见的可能是pandasmatplotlib numpy is also good for processing your data. numpy也适合处理您的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM