qq_39790803 2021-06-06 11:13 采纳率: 33.3%
浏览 1233
已结题

请问大佬如何设置matplotlib子图table边框的粗细

默认的table边框较粗,想改一下,网上找了几个方法都没成功。

for cell_key, cell_i in table4.get_celld().items():
    cell_i.set_linewidth = line_width

cell6 = table6.get_celld()
for cell_y in range(stock_k):
    for cell_x in range(3):
        cell6[cell_x, cell_y].set_width = line_width

说明文档好像没提这块,或许是没找到。求教大佬们~~~~

  • 写回答

4条回答 默认 最新

  • 关注
    import numpy as np
    import matplotlib.pyplot as plt
    y = np.arange(1,10,1)
    x = np.arange(1,10,1)
    bwith = 1 #边框宽度设置为2
    ax = plt.gca()#获取边框
    ax.spines['top'].set_color('red')  # 设置上‘脊梁’为红色
    ax.spines['right'].set_color('none')  # 设置上‘脊梁’为无色
    ax.spines['bottom'].set_linewidth(bwith)
    ax.spines['left'].set_linewidth(bwith)
    ax.spines['top'].set_linewidth(bwith)
    ax.spines['right'].set_linewidth(bwith)
    plt.grid( color = 'black',linestyle='-.',linewidth = 1)
    plt.plot(x,y)
    

    代码如上,万望采纳。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 9月12日
  • 已采纳回答 9月4日

悬赏问题

  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上