Plot 2-dimensional NumPy array using specific columns

后端 未结 2 761
你的背包
你的背包 2021-01-03 23:14

I have a 2D numpy array that\'s created like this:

data = np.empty((number_of_elements, 7))

Each row with 7 (or whatever) floats represents

2条回答
  •  花落未央
    2021-01-03 23:46

    Not sure exactly what you are looking for in the plot, but you can slice 2D arrays like this:

    >>> a
    array([[0, 1, 2],
           [3, 4, 5],
           [6, 7, 8]])
    >>> a[:,1]
    array([1, 4, 7])
    >>> a[:,1:3]
    array([[1, 2],
           [4, 5],
           [7, 8]])
    

    Then some matplot to take care of the plotting. If you find what you are looking for at the Matplotlib Gallery I can help you more.

提交回复
热议问题