我有一个带有色条的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}
我实际上是按照描述的方式使用import。知道为什么找不到colorbar 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中投票给他答案!