Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def getNewByIndex(self, x, lines):
data = self.data.take([x]+lines, axis=1)
G = Graphics2dObj(data, 0)
G.setDataLabels([self.data_lines[x]] + [self.data_lines[i] for i in lines])
return G
self.selected = selected
else:
selected = []
# working on this ... think I'm almost finished now
def getNewByIndex(self, x, lines):
data = self.data.take([x]+lines, axis=1)
G = Graphics2dObj(data, 0)
G.setDataLabels([self.data_lines[x]] + [self.data_lines[i] for i in lines])
return G
# working on this ... think I'm almost finished now
def getNewByName(self, x, lines):
return self.getNewByIndex(self.getIdx(x), [self.getIdx(l) for l in lines])
class Graphics3dObj(Graphics2dObj):
ztitle = 'z'
zlog = False
__dims__ = 3
def __init__(self, data, xidx, yidx):
self.setData(data)
self.setAxis(x=xidx, y=yidx)
class PyscesGPlot2MPL:
"""
Old 'gnuplot' plotting functions using a matplotlib backend
"""
mode_interactive = True
mode_create_new_figure = True
new_figure_generator = None
current_figure = None
def plotX(self, data):
if self.mode_create_new_figure:
self.setNewFigure()
if not self.mode_hold: self.P.clf()
D = Graphics2dObj(data, None)
## print type(D)
## print D.var_idx
## print D.data[1]
self.P.plot(D.getVarData())
def plot2D(self, data, x, ylist=[], labels=None, style=None):
assert type(ylist) == list, '\nylist must be a list'
if self.mode_create_new_figure:
self.setNewFigure()
if not self.mode_hold: self.P.clf()
D = Graphics2dObj(data, x)
if labels != None: D.setDataLabels(labels)
if len(ylist) == 0:
print('ylist empty plotting all data vs (%s)' % x)
ylist = list(range(data.shape[1]))
ylist.pop(ylist.index(x))
if len(ylist) > 0:
ylt = (numpy.array(ylist) < D.data_shape[1])
assert type(ylt) == numpy.ndarray, '\nInvalid y list this can be caused by a forgotten keyword labels='
assert ylt.all(), '\nInvalid y index'
D = D.getNewByIndex(x, ylist)
self.P.ioff()
usedline = []
for line in D.data_lines:
L = getattr(D, line)
## print line, D.xaxis.idx, L.idx
if L.idx != D.xaxis.idx and line not in usedline:
def plotLines2DX(self, data, x, labels=None):
if not self.mode_hold: self.P.clf()
## F = self.P.figure(1)
## S = self.P.subplot(1,1,1)
D = Graphics2dObj(data, x)
print(D.var_idx)
print(D.data[1])
self.P.plot(D.xaxis.data, D.getVarData())