plot_dual.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:xbox-controller-plot 作者: cookacounty 项目源码 文件源码
def __init__(self):
        fig = plt.figure(figsize=(10,4))
        a1_z   = fig.add_subplot(1, 11, 1)
        a1_xy = fig.add_subplot(1, 11, (2, 6))
        a2_z   = fig.add_subplot(1, 11, 7)
        a2_xy = fig.add_subplot(1, 11, (8, 12))
        plt.tight_layout()
        fig.suptitle("3D Sensor and Xbox Controller Demo", fontsize=18)


        plt.setp(a1_z.get_xticklabels(), visible=False)
        plt.setp(a2_z.get_xticklabels(), visible=False)


        a1_z.set_title('3D Sensor Z')
        a2_z.set_title('Xbox L Z')

        a1_xy.set_title('3D Sensor XY')
        a2_xy.set_title('Xbox L XY')

        # Joy 1 Z
        a1_z.set_ylabel('z')
        self.line_z1 = Line2D([], [], color='blue', linewidth=20)
        a1_z.add_line(self.line_z1)
        a1_z.set_xlim(-1, 1)
        a1_z.set_ylim(-1, 1)

        # Joy 1 XY
        a1_xy.set_xlabel('x')
        a1_xy.set_ylabel('y')
        self.line_xy1 = Line2D([], [], color='green', linewidth=3)
        a1_xy.add_line(self.line_xy1)
        a1_xy.set_xlim(-1, 1)
        a1_xy.set_ylim(-1, 1)

        # Joy 2 Z
        a2_z.set_ylabel('z')
        self.line_z2 = Line2D([], [], color='blue', linewidth=20)
        a2_z.add_line(self.line_z2)
        a2_z.set_xlim(-1, 1)
        a2_z.set_ylim(0, 1)
        # Joy 2 XY
        a2_xy.set_xlabel('x')
        a2_xy.set_ylabel('y')
        self.line_xy2 = Line2D([], [], color='green', linewidth=3)
        a2_xy.add_line(self.line_xy2)
        a2_xy.set_xlim(-1, 1)
        a2_xy.set_ylim(-1, 1)

        animation.TimedAnimation.__init__(self, fig, interval=50, blit=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号