Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

psd() draw a wrong line with sliced array(Matplotlib 1.4.0) #3465

Closed
ytchanglp opened this issue Sep 4, 2014 · 2 comments
Closed

psd() draw a wrong line with sliced array(Matplotlib 1.4.0) #3465

ytchanglp opened this issue Sep 4, 2014 · 2 comments
Milestone

Comments

@ytchanglp
Copy link

Check this issue by the following code.
The lines in the plot should be the same.

import numpy as np
import matplotlib.pyplot as plt

data = np.arange(1000)

a = np.empty((1000, 2))
b = np.empty((2, 1000))

plt.figure()

a[:, 0] = data
plt.psd(a[:, 0])

b[0, :] = data
plt.psd(b[0, :])

plt.show()

figure_1

@cimarronm
Copy link
Contributor

This is a bug in mlab. PR #3467 should fix it for you.

In the meantime, you can make this work by flattening your input to psd, e.g. psd(x.flatten())

For your example:

import numpy as np
import matplotlib.pyplot as plt

data = np.arange(1000)

a = np.empty((1000, 2))
b = np.empty((2, 1000))

plt.figure()

a[:, 0] = data
plt.psd(a[:, 0].flatten())

b[0, :] = data
plt.psd(b[0, :].flatten())

plt.show()

@tacaswell tacaswell added this to the v1.4.1 milestone Sep 6, 2014
@tacaswell
Copy link
Member

closed by #3467

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants