def typlot(*args, **kwargs): """Create a time plot of the given variable""" _require_plot_mode(tplot_mod.TYCURVE) # If args not specified then get args using asynchronous input if not args: yield "Y VARIABLE " args = kwargs["io_helper"].get_input().split() if not args: args = [" "] args = list(args) var = _find_variable_or_raise_exception(state.reader, args.pop(0)) if var.type == GLOBAL_VARIABLE: if args: blot_common.print_blot_warning("Extra tokens after global " "variable name ignored.") c = tplot_mod.Curve(var) state.tplot.add_curve(c) state.tplot.print_show() return if not args: raise BlotishError("Expected node/element number") s = " ".join(args) try: selected_ids = number_list_parser.parse_number_list(s, int) except number_list_parser.Error, err: raise BlotishError(err)
def extract_variable_and_ids(args): # convert to list of at least one token if not args: args = [" "] args = list(args) # treat the first token as a variable name to lookup a variable var = _find_variable_or_raise_exception(state.reader, args.pop(0)) # variable must not be a global if var.type == GLOBAL_VARIABLE: raise BlotishError("XYPlot does not support global variables") return # Now parse the remaining tokens as a list of numbers and number ranges if not args: raise BlotishError("Expected node/element number") s = " ".join(args) try: selected_ids = number_list_parser.parse_number_list(s, int) except number_list_parser.Error, err: raise BlotishError(err)