added code to poll and plot a graph