抑制来自 matplotlib sphinx 扩展的超链接

Suppress hyperlinks from matplotlib sphinx extension

我正在使用 sphinxmatplotlib.sphinxext.plot_directive 扩展在某些文档中动态创建一些绘图。在我的一个 .rst 文件中,我有以下命令

.. plot:: plots/normal_plots.py

这基本上只是运行一些 matplotlib 代码,例如

plt.plot(x, y)
plt.show()

这成功创建并嵌入了图表,但在其正上方添加了以下四个超链接

(Source code, png, hires.png, pdf)

如果您查看 matplotlib examples 上的任何示例,它们的所有图旁边都有这四个链接。

有没有办法抑制超链接?我只想要图表,但不想每次插入图表时都用这些链接弄乱我的文档。

为此有两个配置选项:

  • plot_html_show_source_link
  • plot_html_show_formats

在 conf.py 中将两个选项设置为 False 以抑制超链接。

参考:https://matplotlib.org/api/sphinxext_plot_directive_api.html#configuration-options.