Beispiel #1
0
            dist_val = 0

        # Remove first element of each list
        dist_data.pop(0)

        dist_data.append(dist_val)

        axis_plot.clear()
        axis_plot.plot(indicies, dist_data, 'r', label='X Axis')

        axis_plot.set_title('Axis Plot')
        axis_plot.set_xlabel('Time')
        axis_plot.set_ylabel('Distance (cm)')
        axis_plot.grid(True)

        axis_plot.legend(loc='best')

    animation = FuncAnimation(fig, update, interval=50)

    # Output of FuncAnimation MUST BE USED or it does not work
    if animation:
        pass

    plt.show()


print(__name__)
# If we are on the main thread, run the program
if __name__ == "__main__":
    LocoRobo.graph(run_robot=run_robot, run_graph=graph)