I'm new to matplotlib and am really enjoying using it. I'm confused by something
though:
If I plot the following linear regression it works as expected.
from pylab import *
x = range(10)
y = range(10)
m,b = polyfit(x, y, 1)
plot(x, y, 'yo', x, m*x+b, '--k')
show()
The following code produces an error though (only the length of the vectors have
been changed):
from pylab import *
x = range(11)
y = range(11)
m,b = polyfit(x, y, 1)
plot(x, y, 'yo', x, m*x+b, '--k')
show()
I'm using:
python 2.5
matplotlib 0.98.5.2
numpy 1.3.0
Below is the error message:
Traceback (most recent call last):
File "<stdin>", line 8, in <module>
File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 2096, in plot
ret = gca().plot(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 3277, in plot
for line in self._get_lines(*args, **kwargs):
File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 401, in
_grab_next_args
for seg in self._plot_3_args(remaining, **kwargs):
File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 340, in
_plot_3_args
x, y, multicol = self._xy_from_xy(x, y)
File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 228, in
_xy_from_xy
assert nrx == nry, 'Dimensions of x and y are incompatible'
AssertionError: Dimensions of x and y are incompatible
Unbunt Hardy 8.04
Thanks,
Juls