如何将带有colorbar的matplotlib pgf导入到latex文档中

问题描述 投票:0回答:1

我有一个带有色条的matplotlib图。我将数字保存为PGF,因此我可以在乳胶文档中使用。图表进入不同的目录。导入它们时,不显示颜色条。

some chart

在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吗?

matplotlib latex pgf
1个回答
0
投票

我可以用这里的答案来解决它:

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中投票给他答案!

© www.soinside.com 2019 - 2024. All rights reserved.