【问题标题】:Changing the color of the rticklabels in a polar plot更改极坐标图中 rticklabels 的颜色
【发布时间】:2016-08-05 05:54:24
【问题描述】:

我想将极坐标图中的 rticklabels 的颜色更改为白色。 它适用于

ax.set_rgrids([1., 2., 3.], color='white')

但是,使用set_rgrids 我必须给出刻度标签的位置。我宁愿使用标准位置,这样我就不必为不同的数据集考虑它们的值。

我有办法直接访问和更改 rticklabels 的颜色吗?

【问题讨论】:

    标签: python matplotlib colors label polar-coordinates


    【解决方案1】:

    有一种方法:对于极坐标图,thetar 分别映射到 xy 用于通用轴动作。所以 - 你就这样做

    rlabels = ax.get_ymajorticklabels()
    for label in rlabels:
        label.set_color('white')
    

    Documentation for get_ymajorticklabels() 表明它返回Text 对象的列表 - 您可以对Text 对象执行的操作是in the docs

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-09
      • 1970-01-01
      • 1970-01-01
      • 2022-07-25
      • 1970-01-01
      • 2020-10-25
      • 1970-01-01
      • 2013-06-13
      相关资源
      最近更新 更多