Matplotlib轴编辑问题

时间:2016-09-06 15:12:01

标签: python python-3.x matplotlib

我正在尝试在一个窗口上设置4个图表,每秒更新4个不同模拟输入(动态图)的值。如何设置轴(并可能将它们标记为0%到100%),以便它们不会更新。我也希望窗口能够全屏运行,但我尝试过的技术只会给我错误,如果有人能指出我的好教程那就太棒了!这是我到目前为止的代码

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()

0 个答案:

没有答案