matplotlib - 如何将带有颜色条的matplotlib pgf导入乳胶文档
问题描述
我有一个带有颜色条的 matplotlib 图。我将图形保存为 PGF,以便可以在乳胶文档中使用。图表进入不同的目录。当我导入它们时,不会显示颜色栏。
在 PGF 文件中,有一些说明:
%% Figures using additional raster images can only be included by \input if
%% they are in the same directory as the main LaTeX file. For loading figures
%% from other directories you can use the `import` package
%% \usepackage{import}
%% and then include the figures with
%% \import{<path to file>}{<filename>.pgf}
我实际上是按照描述的方式使用导入。知道为什么找不到颜色条 png 吗?
解决方案
我可以使用这里的答案来解决它:
https://tex.stackexchange.com/a/282110/91843
在文件的开头,我不得不说:
\newcommand\inputpgf[2]{{
\let\pgfimageWithoutPath\pgfimage
\renewcommand{\pgfimage}[2][]{\pgfimageWithoutPath[##1]{#1/##2}}
\input{#1/#2}
}}
然后我可以使用导入:
\inputpgf{path/to/figures}{figure.pgf}
注意:请在 Tex 中投票给他的答案!
推荐阅读
- python - Scrapy:忽略响应 403
- angular - 如何显示离子列表中所选项目的实际计数?
- java - 创建 Flux.fromIterable 后如何运行 onClose 操作?
- python - 为什么我得到 AttributeError: 'NoneType' 对象没有属性 'contains'?
- python - 我的代码在 mongodb 中工作,但在 pymongo 中不工作
- c - 我应该在 .h 文件中定义函数还是只声明它们?
- javascript - 如何从 react hooks 或 useEffect 获取新的更新数据?
- c# - 从为选定的 wpf 组合框值绑定的属性中获取 null
- react-native - undefined 不是 react-native 中的对象(评估“process.version.split”)
- java - 在webdriver中,复选框必须检查复选框是否选中或选中的基本属性是什么