TypeError: only length-1 arrays can be converted to Python scalars while plot showing : <p>I have such Python code:</p>

<pre><code>import numpy as np
import matplotlib.pyplot as plt

def f(x):
    return np.int(x)

x = np.arange(1, 15.1, 0.1)
plt.plot(x, f(x))
plt.show()
</code></pre>

<p>And such error:</p>

<pre><code>TypeError: only length-1 arrays can be converted to Python scalars
</code></pre>

<p>How can I fix it?</p>
