- changes to get some examples working on my side

(test_PlotWidget.py, test_MultiPlotWidget.py)
  (ubuntu 10.10, python 2.6.6, qt 4.7.0, pyqt 4.7.4, numpy 1.3.0)
This commit is contained in:
Ingo B. 2011-02-03 11:03:13 +01:00
parent 661e4411e2
commit bf1e59ca22
3 changed files with 4 additions and 3 deletions

View File

@ -998,7 +998,7 @@ class PlotItem(QtGui.QGraphicsWidget):
if arr.ndim != 1:
raise Exception("Array must be 1D to plot (shape is %s)" % arr.shape)
if x is None:
x = arange(arr.shape[0])
x = np.arange(arr.shape[0])
if x.ndim != 1:
raise Exception("X array must be 1D to plot (shape is %s)" % x.shape)
c = PlotCurveItem(arr, x=x)

View File

@ -5,6 +5,7 @@ import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
from scipy import random
from numpy import array, arange
from PyQt4 import QtGui, QtCore
from pyqtgraph.PlotWidget import *
from pyqtgraph.graphicsItems import *
@ -90,4 +91,4 @@ for i in range(0, 5):
yd, xd = rand(10000)
pw2.plot(yd*(j+1), xd, params={'iter': i, 'val': j})
#app.exec_()
app.exec_()

View File

@ -573,7 +573,7 @@ class PlotCurveItem(GraphicsObject):
self.xData = x
if x is None:
self.xData = arange(0, self.yData.shape[0])
self.xData = np.arange(0, self.yData.shape[0])
if self.xData.shape != self.yData.shape:
raise Exception("X and Y arrays must be the same shape--got %s and %s." % (str(x.shape), str(y.shape)))