bug in plot

matplotlib apparently can’t plot numeric arrays with shape (x,1). Check the code below.
This is an important drawback because for some matrix operations, such as concatenation it is necessary to specify if the vector is a line or a column, and these vector can’t be plotted.
I think this happens for the same reasons matplotlib can’t plot matrices as a multiline plot like matlab. IMHO, the plot command should allow for plotting matrices line-by-line like matlab, it is very useful.


Python 2.3.3 (#2, Feb 17 2004, 11:45:40)

[GCC 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)] on linux2

Type “help”, “copyright”, “credits” or “license” for more information.

from matplotlib.matlab import *

Building TTF font cache for non-PS backends. Saving to /home/fccoelho/.ttffont.cache.

Delete this file if you want the cache rebuilt the next time you run


a= arange(9)





(9, 1)


Traceback (most recent call last):

File “”, line 1, in ?

File “/usr/lib/python2.3/site-packages/matplotlib/matlab.py”, line 1030, in plot

try: lines =  gca().plot(*args, **kwargs)

File “/usr/lib/python2.3/site-packages/matplotlib/axes.py”, line 1324, in plot


File “/usr/lib/python2.3/site-packages/matplotlib/axes.py”, line 381, in add_line


File “/usr/lib/python2.3/site-packages/matplotlib/axes.py”, line 361, in update_datalim

self.dataLim.update(xys, not self.has_data())

TypeError: only rank-0 arrays can be converted to Python scalars.

Flávio Codeço Coelho, PhD

Programa de Computação Científica

Fundação Oswaldo Cruz

Rio de Janeiro – Brasil