0
x=[[ 0.          0.00221864  0.00488273 ..., -0.03966467 -0.03691193  -0.03415696]]
y=[[  0.00000000e+00   5.00000000e-03   1.00000000e-02 ...,   7.06000000e+00, 
       7.06500000e+00   0.00000000e+00]]
plt.plot(x,y)  
plt.show()

The data both have 1415 columns.
Then the figure looks like the following
enter image description here

Why does it show nothing?
Thanks for answering!

0

1 Answer 1

1

You can't use nested lists to plot your data.
The following plots nothing

import matplotlib.pyplot as plt

x = [[1,2,3,4]]
y = [[2,3,1,4]]

plt.plot(x,y)
plt.show()

While this plots the values as expected.

import matplotlib.pyplot as plt

x = [1,2,3,4]
y = [2,3,1,4]

plt.plot(x,y)
plt.show()
Sign up to request clarification or add additional context in comments.

2 Comments

You can if x = [[1],[2],[3],[4]]; y = [[2],[3],[1],[4]]
The issue is that the length is computed from the outermost list. Notice that the axis limits are actually correct in the first case even though nothing shows up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.