Commit bf1e59ca authored by Ingo B.'s avatar Ingo B.
Browse files

- 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)
parent 661e4411
...@@ -998,7 +998,7 @@ class PlotItem(QtGui.QGraphicsWidget): ...@@ -998,7 +998,7 @@ class PlotItem(QtGui.QGraphicsWidget):
if arr.ndim != 1: if arr.ndim != 1:
raise Exception("Array must be 1D to plot (shape is %s)" % arr.shape) raise Exception("Array must be 1D to plot (shape is %s)" % arr.shape)
if x is None: if x is None:
x = arange(arr.shape[0]) x = np.arange(arr.shape[0])
if x.ndim != 1: if x.ndim != 1:
raise Exception("X array must be 1D to plot (shape is %s)" % x.shape) raise Exception("X array must be 1D to plot (shape is %s)" % x.shape)
c = PlotCurveItem(arr, x=x) c = PlotCurveItem(arr, x=x)
......
...@@ -5,6 +5,7 @@ import sys, os ...@@ -5,6 +5,7 @@ import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
from scipy import random from scipy import random
from numpy import array, arange
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
from pyqtgraph.PlotWidget import * from pyqtgraph.PlotWidget import *
from pyqtgraph.graphicsItems import * from pyqtgraph.graphicsItems import *
...@@ -90,4 +91,4 @@ for i in range(0, 5): ...@@ -90,4 +91,4 @@ for i in range(0, 5):
yd, xd = rand(10000) yd, xd = rand(10000)
pw2.plot(yd*(j+1), xd, params={'iter': i, 'val': j}) pw2.plot(yd*(j+1), xd, params={'iter': i, 'val': j})
#app.exec_() app.exec_()
...@@ -573,7 +573,7 @@ class PlotCurveItem(GraphicsObject): ...@@ -573,7 +573,7 @@ class PlotCurveItem(GraphicsObject):
self.xData = x self.xData = x
if x is None: 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: 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))) raise Exception("X and Y arrays must be the same shape--got %s and %s." % (str(x.shape), str(y.shape)))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment