|
self.ydata = numpy.transpose(self.ydata) |
In the following code:
if numpy.ndim(self.ydata) == 2: self.ydata = numpy.transpose(self.ydata)
it's better to replace np.transpose() with the shorthand .T:
if numpy.ndim(self.ydata) == 2: self.ydata = self.ydata.T
Both versions produce the same result for 2D arrays, but .T is more efficient as it directly accesses the array’s transpose property without invoking a function call. It also improves code clarity and conforms to standard NumPy coding practices.