【问题标题】:plot python figure with ticks only and not axes lines仅绘制带有刻度而不是轴线的python图形
【发布时间】:2014-07-21 18:44:52
【问题描述】:

我想在 python 中绘制一个图并且只有刻度,我不想看到轴线,只有刻度。

我该怎么做?

matplotlib.版本 = 1.3.0

【问题讨论】:

    标签: python matplotlib axes


    【解决方案1】:

    你可以使用

    fig, ax =  subplots()
    ax.set_frame_on(False)
    

    要了解蜱、刺等。请查看图库中的此条目:http://matplotlib.org/examples/ticks_and_spines/spines_demo_bounds.html

    有很多功能可以改变这些元素的位置和外观。有关制作精美情节的更多信息,请查看 http://blog.olgabotvinnik.com/post/58941062205/prettyplotlib-painlessly-create-beautiful-matplotlib

    【讨论】:

      【解决方案2】:

      您可以尝试将轴的颜色设置为您的背景颜色。 假设白色:

      for child in ax.get_children():
          if isinstance(child, matplotlib.spines.Spine):
              child.set_color('#FFFFFF')
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-04-07
        • 2018-05-17
        • 1970-01-01
        • 2011-03-30
        • 2020-06-06
        • 1970-01-01
        相关资源
        最近更新 更多