1

I am trying to set up 4 plots on a window that update every second with value from 4 different analog inputs (dynamic plot). How would I set the axis (and possibly label them as 0% to 100%) so they don't update. I would also like the window to run fullscreen but the techniques I have tried just give me errors, if anyone could point me to a good tutorial that would be great! Here is my code so far

import matplotlib.pyplot as plt
import matplotlib.animation as animation

fig = plt.figure()
ax1 = fig.add_subplot(1,2,1)
ax2 = fig.add_subplot(1,2,2)

#Function to read analog inputs
def readadc(.....)

def animate(i):
    colorVar = 'g'
    graph_data = readadc(...)

    if (graph_data , 300):
        colorVar = 'r'
    else:
        colorVar = 'g'
    ax1.clear()
    ax2.clear()

    ax1.axes.get_xaxis().set_ticks([])
    ax2.axes.get_xaxis().set_ticks([])

    ax1.bar(0,graph_data, color=colorVar)
    ax2.bar(0,graph_data, color=colorVar)

ani = animation.FuncAnimation(fig, animate, interval=1000)
mng = plt.get_current_fig_manager()
mng.ax1.Maximize(True)
plt.show()
Sayali Sonawane
  • 12,289
  • 5
  • 46
  • 47
Jamessin
  • 13
  • 4
  • As for how to run full-screen: http://stackoverflow.com/questions/12439588/how-to-maximize-a-plt-show-window-using-python , http://stackoverflow.com/questions/28187202/extend-python-plots-to-full-screen among others – Scott Mermelstein Sep 06 '16 at 15:31
  • Yes I just found that about 2 minutes ago! Sorry for the duplicate. – Jamessin Sep 06 '16 at 15:33
  • It happens. Most of the time, I find that once I type in enough of a question for the stack overflow code to understand what I want, it points me to a question that has the answer I need. You'll get used to checking for that. :-) – Scott Mermelstein Sep 06 '16 at 15:35
  • Thanks for understanding! I got everything to work except the axis labels but I'm sure after enough digging that will come up also! – Jamessin Sep 06 '16 at 15:38

0 Answers0