No visible text() when using matplotlib.pyplot
<p>matplotlib==1.5.2
pylab==0.1.3</p>

<p>I am trying to reproduce a graph from the course <a href="http://cs224d.stanford.edu/syllabus.html" rel="nofollow">"CS224d Deep Learning for NLP"</a>, <a href="http://cs224d.stanford.edu/lectures/CS224d-Lecture2.pdf" rel="nofollow">Lecture 2</a>.</p>

<p>It should look the following way:</p>

<p><a href="http://i.stack.imgur.com/ykswK.png" rel="nofollow"><img src="http://i.stack.imgur.com/ykswK.png" alt="enter image description here"></a></p>

<p>I am using the following code:</p>

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

la = np.linalg

words = ['I', 'like', 'enjoy', 'deep', 'learning', 'NLP', 'flying', '.'] 

X = np.array([[0,2,1,0,0,0,0,0],
              [2,0,0,1,0,1,0,0],
              [1,0,0,0,0,0,1,0],
              [0,1,0,0,1,0,0,0],
              [0,0,0,1,0,0,0,1],
              [0,1,0,0,0,0,0,1],
              [0,0,1,0,0,0,0,1],
              [0,0,0,0,1,1,1,0]])

U, s, Vh = la.svd(X, full_matrices=False)

for i in xrange(len(words)):
    plt.text(U[i,0], U[i,1], words[i])

plt.autoscale()
plt.show()
</code></pre>

<p>However, the words don't appear on the graph.</p>

<p>If I remove the instruction </p>

<pre><code>plt.autoscale()
</code></pre>

<ul>
<li>I can see some text plotted in the corner, but the axis range is wrong.</li>
</ul>

<p>If I use this instruction, then I see no text at all, even if I call <em>text()</em> once again.</p>

<p>I have seen solutions with using subplots and setting the exact ranges for <em>x</em> and <em>y</em> axis, but this seems to be unnecessarily complex.</p>

<p>What else can I try? </p>

<p>It shows the words when you set axis limits to show the text as per this answer below.  </p>

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

la = np.linalg

words = ['I', 'like', 'enjoy', 'deep', 'learning', 'NLP', 'flying', '.'] 

X = np.array([[0,2,1,0,0,0,0,0],
              [2,0,0,1,0,1,0,0],
              [1,0,0,0,0,0,1,0],
              [0,1,0,0,1,0,0,0],
              [0,0,0,1,0,0,0,1],
              [0,1,0,0,0,0,0,1],
              [0,0,1,0,0,0,0,1],
              [0,0,0,0,1,1,1,0]])

U, s, Vh = la.svd(X, full_matrices=False)

fig, ax = plt.subplots()
for i in xrange(len(words)):
    ax.text(U[i,0], U[i,1], words[i])

ax.set_xlim([-0.8, 0.2])
ax.set_ylim([-0.8, 0.8])
plt.show()
</code></pre>

python matplotlib