开发者社区> 问答> 正文

python做图形化界面时怎么画矩形

python做图形化界面时怎么画矩形

展开
收起
云计算小粉 2018-05-10 20:10:57 2204 0
1 条回答
写回答
取消 提交回答
  • 阿里云大学导师

    您好,矩形绘制案例请参考:

    -- coding: utf-8 --

    """
    Created on Thu Aug 11 18:12:37 2016

    @author: Eddy_zheng
    """

    import matplotlib.pyplot as plt
    import matplotlib.patches as patches

    fig1 = plt.figure()
    ax1 = fig1.add_subplot(111, aspect='equal')
    ax1.add_patch(

    patches.Rectangle(
        (0.1, 0.1),   # (x,y)
        0.5,          # width
        0.5,          # height
    )

    )
    fig1.savefig('rect1.png', dpi=90, bbox_inches='tight')

    2019-07-17 22:23:55
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载
双剑合璧-Python和大数据计算平台的结合 立即下载