def plot(workspace, tokens=None): """When called from window.py it initiates rendering of equations. Arguments: workspace {QtWidgets.QWidget} -- main layout """ from visma.io.tokenize import tokenizer workspace.figure2D.clear() workspace.figure3D.clear() if tokens is None: tokens = workspace.eqToks[-1] eqType = getTokensType(tokens) LHStok, RHStok = getLHSandRHS(tokens) variables = sorted(getVariables(LHStok, RHStok)) dim = len(variables) graphVars, func, variables = graphPlot(workspace, False, tokens) renderPlot(workspace, graphVars, func, variables, tokens) if (dim == 1): var2, var3 = selectAdditionalVariable(variables[0]) if tokens is None: workspace.eqToks[-1] += tokenizer("0" + var2 + "+" + "0" + var3) else: tokens += tokenizer("0" + var2 + "+" + "0" + var3) if (((dim == 2) or (dim == 1)) & (eqType == 'equation')): graphVars, func, variables = graphPlot(workspace, True, tokens) renderPlot(workspace, graphVars, func, variables, tokens)