def cmd_graph(args):
    '''graph command'''
    usage = "usage: graph <FIELD...>"
    if len(args) < 1:
        print(usage)
        return
    if args[0][0] == ':':
        i = int(args[0][1:])
        g = mestate.graphs[i]
        expression = g.expression
        args = expression.split()
        mestate.console.write("Added graph: %s\n" % g.name)
        if g.description:
            mestate.console.write("%s\n" % g.description, fg='blue')
        mestate.rl.add_history("graph %s" % ' '.join(expression.split()))
        mestate.last_graph = g
    else:
        expression = ' '.join(args)
        mestate.last_graph = GraphDefinition(mestate.settings.title, expression, '', [expression], None)
    grui.append(Graph_UI(mestate))
    grui[-1].display_graph(mestate.last_graph, flightmode_colours())
    global last_xlim
    if last_xlim is not None and mestate.settings.sync_xzoom:
        #print("initial: ", last_xlim)
        grui[-1].set_xlim(last_xlim)
def cmd_graph ( args ) : usage = "usage: graph <FIELD...>" if len ( args ) < 1 : print ( usage ) return if args [ 0 ] [ 0 ] == ':' : i = int ( args [ 0 ] [ 1 : ] ) g = mestate . graphs [ i ] expression = g . expression args = expression . split ( ) mestate . console . write ( "Added graph: %s\n" % g . name ) if g . description : mestate . console . write ( "%s\n" % g . description , fg = 'blue' ) mestate . rl . add_history ( "graph %s" % ' ' . join ( expression . split ( ) ) ) mestate . last_graph = g else : expression = ' ' . join ( args ) mestate . last_graph = GraphDefinition ( mestate . settings . title , expression , '' , [ expression ] , None ) grui . append ( Graph_UI ( mestate ) ) grui [ - 1 ] . display_graph ( mestate . last_graph , flightmode_colours ( ) ) global last_xlim if last_xlim is not None and mestate . settings . sync_xzoom : grui [ - 1 ] . set_xlim ( last_xlim )
graph command