[2Dplot] works, not tested with zoom, though

This commit is contained in:
Jan Grewe 2021-02-27 17:27:50 +01:00
parent b0c020891f
commit 17b3e99d43
2 changed files with 7 additions and 6 deletions

View File

@ -430,12 +430,13 @@ class LinePlotter(Plotter):
y = self._dataview._buffer[i, int(start):int(end)] y = self._dataview._buffer[i, int(start):int(end)]
if len(self.lines) <= i: if len(self.lines) <= i:
ll, = self.axis.plot(x, y, label=l, picker=5) ll, = self.axis.plot(x, y, label=l)
ll.set_pickradius(5)
self.lines.append(ll) self.lines.append(ll)
else: else:
self.lines[i].set_ydata(y) self.lines[i].set_ydata(y)
self.lines[i].set_xdata(x) self.lines[i].set_xdata(x)
self.axis.legend()
self.axis.set_xlim([x[0], x[-1]]) self.axis.set_xlim([x[0], x[-1]])
def plot_array_1d(self, start=0): def plot_array_1d(self, start=0):
@ -446,8 +447,8 @@ class LinePlotter(Plotter):
self.axis.set_ylabel(ylabel) self.axis.set_ylabel(ylabel)
self.view_changed.emit() self.view_changed.emit()
def plot_array_2d(self): def plot_array_2d(self, start=0):
self.__draw_2d(0, self.maxpoints) self.__draw_2d(start, start + self._segment_length)
xlabel = create_label(self.dimensions[self.xdim]) xlabel = create_label(self.dimensions[self.xdim])
ylabel = create_label(self._item) ylabel = create_label(self._item)
self.axis.set_xlabel(xlabel) self.axis.set_xlabel(xlabel)

View File

@ -276,8 +276,8 @@ class FileHandler(metaclass=Singleton):
dim = da.dimensions[dimension_index] dim = da.dimensions[dimension_index]
if dim.dimension_type == nix.DimensionType.Set: if dim.dimension_type == nix.DimensionType.Set:
labels = dim.labels labels = dim.labels
if start + count > len(labels): if len(labels) > 0 and start + count > len(labels):
raise ValueError("Invalid argument for start, count for SetDimension") raise ValueError("Invalid argument for start or count for SetDimension")
axis = labels[start:start + count] axis = labels[start:start + count]
if len(labels) == 0: if len(labels) == 0:
axis = list(map(str, range(start, start+count))) axis = list(map(str, range(start, start+count)))