【问题标题】:Remove Letter Labels on Holoviews Figures with Matplotlib Backend使用 Matplotlib 后端删除 Holoviews 图上的字母标签
【发布时间】:2019-10-10 16:10:37
【问题描述】:

当我使用 Matplotlib 后端创建包含两个或多个图的 Holoviews 图时,我会为每个图标上一个字母(A、B 等)。例如:

import numpy as np
import holoviews as hv
hv.extension('matplotlib')

test = hv.Points(np.random.random(20).reshape(-1, 2)) + \
    hv.Points(np.random.random(20).reshape(-1, 2))

test

(我的低声誉不允许我在此处发布输出的图像,但这是来自Holoviews Documentation 的另一个示例。)

我想这些在这里的想法是更准确地标记已发表论文中的静态数字,但我的用例不需要它。鉴于样式看起来很像 pure Matplotlib 中的样式,我想这是隐藏在源代码中的有意识的选择,但我无法找到它或弄清楚如何将其关闭。有没有办法打开和关闭这些字母标签?

【问题讨论】:

    标签: python holoviews


    【解决方案1】:

    当然,只需使用sublabel_format 选项:

    import numpy as np
    import holoviews as hv
    hv.extension('matplotlib')
    
    test = hv.Points(np.random.random(20).reshape(-1, 2)) + \
           hv.Points(np.random.random(20).reshape(-1, 2))
    
    test.opts(sublabel_format="")
    

    或者,如果您想为所有内容关闭它,您可以将这些行添加到笔记本顶部或您的 ~/.holoviews.rc 文件中:

    from holoviews.plotting.mpl import MPLPlot
    MPLPlot.sublabel_format=""
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-08
      • 2014-10-04
      • 2016-01-30
      • 2011-08-09
      • 2021-09-06
      • 1970-01-01
      • 2018-08-15
      • 1970-01-01
      相关资源
      最近更新 更多