Insert pgf with referenced png file from a different folderWhat is the advantage of using includegraphics...

Why can't we use freedom of speech and expression to incite people to rebel against government in India?

How does energy based projectile blow up a spaceship?

Giving a talk in my old university, how prominently should I tell students my salary?

Who has more? Ireland or Iceland?

How to educate team mate to take screenshots for bugs with out unwanted stuff

What can I do if someone tampers with my SSH public key?

What exactly is the meaning of "fine wine"?

Averaging over columns while ignoring zero entries

How does Sundering Titan handle snow lands?

Paper published similar to PhD thesis

Increase the space between numerator and denominator

How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?

Can inspiration allow the Rogue to make a Sneak Attack?

Why does this boat have a landing pad? (SpaceX's GO Searcher) Any plans for propulsive capsule landings?

Iron deposits mined from under the city

How to make sure I'm assertive enough in contact with subordinates?

Why is my explanation wrong?

How do you make a gun that shoots melee weapons and/or swords?

Should I use HTTPS on a domain that will only be used for redirection?

Inorganic chemistry handbook with reaction lists

I've given my players a lot of magic items. Is it reasonable for me to give them harder encounters?

Insult for someone who "doesn't know anything"

Should I file my taxes? No income, unemployed, but paid 2k in student loan interest

Precision notation for voltmeters



Insert pgf with referenced png file from a different folder


What is the advantage of using includegraphics instead of pgfimage for ordinary image inclusion?Relative paths in a subimport-ed file, when using pdfpagesIncluding a tikz figure with a reference to a table on file, problems with folder structureMatplotlib PGF images in subdirectoryHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?Include .tex file from texmf folderAux files stored in folder with arara, nomencl can't find %.nlo fileReference from a different folderRegarding use of Import packageHelp including images in subfolder with tikz, includegraphics not workingLet tex search a file inside a folder?













1















I'm trying to insert a pgf file that I made with matplotlib. This file references to a png file (since I inserted a png figure in the plot).



When I put the png in the same folder than my tex file, everything works, but if the png file is in the folder with the pgf file, i got an error



Package pgf Warning: File "plot2.png" not found when def
ining image "pgflastimage".


I was trying to use import but I don't know how it works for a pgf. If I change pgf by tex, it still doesn't find the png:



documentclass{article}
usepackage{pgf}
usepackage{import}

begin{document}


% subimport{../pgf/}{plot.pgf} --> Not working
input{../pgf/plot.pgf}

end{document}


EDIT:



Changing pgfimage{...} by includegraphics{...} in the pgf file, seems to work with subimport* . However, matplotlib produces the pgf with pgfimage, so it would be necessary to change the output plots by hand. Maybe someone knows a better solution.










share|improve this question

























  • Where? In the pgf file? =o

    – PerroNoob
    Jul 29 '14 at 22:22











  • Same problem here. I didn't find a proper answer yet..

    – user62681
    Sep 17 '14 at 16:21
















1















I'm trying to insert a pgf file that I made with matplotlib. This file references to a png file (since I inserted a png figure in the plot).



When I put the png in the same folder than my tex file, everything works, but if the png file is in the folder with the pgf file, i got an error



Package pgf Warning: File "plot2.png" not found when def
ining image "pgflastimage".


I was trying to use import but I don't know how it works for a pgf. If I change pgf by tex, it still doesn't find the png:



documentclass{article}
usepackage{pgf}
usepackage{import}

begin{document}


% subimport{../pgf/}{plot.pgf} --> Not working
input{../pgf/plot.pgf}

end{document}


EDIT:



Changing pgfimage{...} by includegraphics{...} in the pgf file, seems to work with subimport* . However, matplotlib produces the pgf with pgfimage, so it would be necessary to change the output plots by hand. Maybe someone knows a better solution.










share|improve this question

























  • Where? In the pgf file? =o

    – PerroNoob
    Jul 29 '14 at 22:22











  • Same problem here. I didn't find a proper answer yet..

    – user62681
    Sep 17 '14 at 16:21














1












1








1


1






I'm trying to insert a pgf file that I made with matplotlib. This file references to a png file (since I inserted a png figure in the plot).



When I put the png in the same folder than my tex file, everything works, but if the png file is in the folder with the pgf file, i got an error



Package pgf Warning: File "plot2.png" not found when def
ining image "pgflastimage".


I was trying to use import but I don't know how it works for a pgf. If I change pgf by tex, it still doesn't find the png:



documentclass{article}
usepackage{pgf}
usepackage{import}

begin{document}


% subimport{../pgf/}{plot.pgf} --> Not working
input{../pgf/plot.pgf}

end{document}


EDIT:



Changing pgfimage{...} by includegraphics{...} in the pgf file, seems to work with subimport* . However, matplotlib produces the pgf with pgfimage, so it would be necessary to change the output plots by hand. Maybe someone knows a better solution.










share|improve this question
















I'm trying to insert a pgf file that I made with matplotlib. This file references to a png file (since I inserted a png figure in the plot).



When I put the png in the same folder than my tex file, everything works, but if the png file is in the folder with the pgf file, i got an error



Package pgf Warning: File "plot2.png" not found when def
ining image "pgflastimage".


I was trying to use import but I don't know how it works for a pgf. If I change pgf by tex, it still doesn't find the png:



documentclass{article}
usepackage{pgf}
usepackage{import}

begin{document}


% subimport{../pgf/}{plot.pgf} --> Not working
input{../pgf/plot.pgf}

end{document}


EDIT:



Changing pgfimage{...} by includegraphics{...} in the pgf file, seems to work with subimport* . However, matplotlib produces the pgf with pgfimage, so it would be necessary to change the output plots by hand. Maybe someone knows a better solution.







pgfplots input import folders






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 29 '14 at 22:34







PerroNoob

















asked Jul 29 '14 at 19:32









PerroNoobPerroNoob

347215




347215













  • Where? In the pgf file? =o

    – PerroNoob
    Jul 29 '14 at 22:22











  • Same problem here. I didn't find a proper answer yet..

    – user62681
    Sep 17 '14 at 16:21



















  • Where? In the pgf file? =o

    – PerroNoob
    Jul 29 '14 at 22:22











  • Same problem here. I didn't find a proper answer yet..

    – user62681
    Sep 17 '14 at 16:21

















Where? In the pgf file? =o

– PerroNoob
Jul 29 '14 at 22:22





Where? In the pgf file? =o

– PerroNoob
Jul 29 '14 at 22:22













Same problem here. I didn't find a proper answer yet..

– user62681
Sep 17 '14 at 16:21





Same problem here. I didn't find a proper answer yet..

– user62681
Sep 17 '14 at 16:21










1 Answer
1






active

oldest

votes


















0














From what I found, there is no better way. This answer notes that pgfimage uses includegraphics, but does not propagate the relative paths. Looking through the matplotlib pgf backend source, changing pgfimage to includegraphics does not appear to be a configurable option on the matplotlib side of the equation.



A work around I came up with was to intercept the output and update the appropriate lines.



# lots of plotting commands
fig.savefig(output)
_, ext = os.path.splitext(output)
if ext == ".pgf":
with open(output, "r") as fid:
lines = fid.readlines()

with open(output, "w") as fid:
for line in lines:
fid.write(re.sub(r"\pgfimage", r"\includegraphics", line))


This is really only a “solution” if you can edit the plotting routines.





share























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f193824%2finsert-pgf-with-referenced-png-file-from-a-different-folder%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    From what I found, there is no better way. This answer notes that pgfimage uses includegraphics, but does not propagate the relative paths. Looking through the matplotlib pgf backend source, changing pgfimage to includegraphics does not appear to be a configurable option on the matplotlib side of the equation.



    A work around I came up with was to intercept the output and update the appropriate lines.



    # lots of plotting commands
    fig.savefig(output)
    _, ext = os.path.splitext(output)
    if ext == ".pgf":
    with open(output, "r") as fid:
    lines = fid.readlines()

    with open(output, "w") as fid:
    for line in lines:
    fid.write(re.sub(r"\pgfimage", r"\includegraphics", line))


    This is really only a “solution” if you can edit the plotting routines.





    share




























      0














      From what I found, there is no better way. This answer notes that pgfimage uses includegraphics, but does not propagate the relative paths. Looking through the matplotlib pgf backend source, changing pgfimage to includegraphics does not appear to be a configurable option on the matplotlib side of the equation.



      A work around I came up with was to intercept the output and update the appropriate lines.



      # lots of plotting commands
      fig.savefig(output)
      _, ext = os.path.splitext(output)
      if ext == ".pgf":
      with open(output, "r") as fid:
      lines = fid.readlines()

      with open(output, "w") as fid:
      for line in lines:
      fid.write(re.sub(r"\pgfimage", r"\includegraphics", line))


      This is really only a “solution” if you can edit the plotting routines.





      share


























        0












        0








        0







        From what I found, there is no better way. This answer notes that pgfimage uses includegraphics, but does not propagate the relative paths. Looking through the matplotlib pgf backend source, changing pgfimage to includegraphics does not appear to be a configurable option on the matplotlib side of the equation.



        A work around I came up with was to intercept the output and update the appropriate lines.



        # lots of plotting commands
        fig.savefig(output)
        _, ext = os.path.splitext(output)
        if ext == ".pgf":
        with open(output, "r") as fid:
        lines = fid.readlines()

        with open(output, "w") as fid:
        for line in lines:
        fid.write(re.sub(r"\pgfimage", r"\includegraphics", line))


        This is really only a “solution” if you can edit the plotting routines.





        share













        From what I found, there is no better way. This answer notes that pgfimage uses includegraphics, but does not propagate the relative paths. Looking through the matplotlib pgf backend source, changing pgfimage to includegraphics does not appear to be a configurable option on the matplotlib side of the equation.



        A work around I came up with was to intercept the output and update the appropriate lines.



        # lots of plotting commands
        fig.savefig(output)
        _, ext = os.path.splitext(output)
        if ext == ".pgf":
        with open(output, "r") as fid:
        lines = fid.readlines()

        with open(output, "w") as fid:
        for line in lines:
        fid.write(re.sub(r"\pgfimage", r"\includegraphics", line))


        This is really only a “solution” if you can edit the plotting routines.






        share











        share


        share










        answered 6 mins ago









        Keith PrussingKeith Prussing

        14816




        14816






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f193824%2finsert-pgf-with-referenced-png-file-from-a-different-folder%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Why does my Macbook overheat and use so much CPU and energy when on YouTube?Why do so many insist on using...

            Puerta de Hutt Referencias Enlaces externos Menú de navegación15°58′00″S 5°42′00″O /...

            How to prevent page numbers from appearing on glossaries?How to remove a dot and a page number in the...