代码之家  ›  专栏  ›  技术社区  ›  Juan Leni

如何将带有颜色条的matplotlib pgf导入到乳胶文档中

  •  0
  • Juan Leni  · 技术社区  · 7 年前

    我有一个有颜色条的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。知道为什么没有找到颜色条png吗?

    1 回复  |  直到 7 年前
        1
  •  0
  •   Juan Leni    7 年前

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

    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}
    

    注:请用特克斯投票!