[SciPy-User] Dimensions of x and y are incompatible

Omer Khalid Omer.Khalid at cern.ch
Mon Aug 3 17:26:41 EDT 2009


Hi,

I am trying to plot two curves on a same graph. The two input datasets are
xdata, ydata and they range between (0.01, 1]  for xdata and (0.1, 1] for
ydata.

I am constantly getting this error when plotting "Dimensions of x and y are
incompatible"

                plt.figure()
                xdata= array(xd)
                ydata = array(xd)

                N=len(xdata)
                print "N: %d" % (N)
                x=arange(0.0, 1.0+0.01, 0.01)
                M=len(ydata)
                print "M: %d" % (M)
                y=arange(0.0, 1.0+0.1, 0.1)
                plt.plot(x,xdata,'r')
                plt.plot(y,ydata,'b')
                plot.legend((xl,yl))
                plt.grid(True)
                plt.title(title)
                plt.xlabel('Value Ratio')
                plt.ylabel('Simulation Time Unit')
                pdf_name = '%s-%s.pdf' %
(str(filename),strftime("%m%d-%M-%S"))
                pwd = os.getcwd()
                path = os.path.join(pwd, exp, pdf_name)
                plt.savefig(path)

I have also tried:
x=arange(1,N)
y=arange(1,M)

But it didn't work. Any help would be much appreciated.

Thanks,
Omer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20090803/7878ea1f/attachment.html>


More information about the SciPy-User mailing list