Matplotlib does not display numbers

This should be a really basic question: I'm trying to use Matplotlib. Here is a basic example from the documentation .

import numpy as np import matplotlib.pyplot as plt x = np.arange(0,5,0.1) y = np.sin(x) plt.plot(x,y) 

I tried this in ipython , bpython , and the default interpreter (Ubuntu 10.10, 64 bit) and all I get are messages like:

 [<matplotlib.lines.Line2D object at 0x3f14a90>] 

What am I doing wrong?

+8
python numpy scipy matplotlib
source share
2 answers

You do not have enough plt.show() to order matplotlib to display the chart window.

+15
source share

In its default configuration, matplotlib must be passed to the renderer. What plt.show () does.

Matplotlib also has an interactive mode that can be useful when you are working in interactive mode, and want your graphing commands to be executed immediately. The easiest way to use this is to open an ipython session with the -pylab option. http://matplotlib.sourceforge.net/users/shell.html

+6
source share

All Articles