Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

Fear of getting stuck on one programming language / technology that is not used in my country

Is there a single word describing earning money through any means?

Why do we read the Megillah by night and by day?

Pre-mixing cryogenic fuels and using only one fuel tank

Is the U.S. Code copyrighted by the Government?

Should I outline or discovery write my stories?

What is this called? Old film camera viewer?

Does the expansion of the universe explain why the universe doesn't collapse?

Removing files under particular conditions (number of files, file age)

Argument list too long when zipping large list of certain files in a folder

When a Cleric spontaneously casts a Cure Light Wounds spell, will a Pearl of Power recover the original spell or Cure Light Wounds?

Non-trope happy ending?

Is it better practice to read straight from sheet music rather than memorize it?

Do Legal Documents Require Signing In Standard Pen Colors?

Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?

Customize circled numbers

React - map array to child component

Closed-form expression for certain product

Why are synthetic pH indicators used over natural indicators?

Which one is correct as adjective “protruding” or “protruded”?

250 Floor Tower

Two line segments inside a regular pentagon forms the same angle with the sides of this pentagon. What is the length of x in the picture?

MTG Artifact and Enchantment Rulings

Is a model fitted to data or is data fitted to a model?



Adding axes to figures


Adding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures













3















I need to add axes to a bunch of figures in my document, I'm trying with tikz but maybe there's an easier and more elegant way to do it (looking at you, overpic)?
The result I'm trying to achieve is not like this, I need the axes to have the arrows as well.



I got some MWE working, but the axes are vertically misaligned (they should be outside of the picture). I've tryed adding vspaces but they don't seem to work as I'd like.



Thanks in advance for your help!



MWE:



output



documentclassscrreprt
usepackagesubfig
usepackagegraphicx
usepackagetikz
begindocument
beginfigure[h!]
vspace-0.6cm
centering
subfloat[]%
begintikzpicture
draw [->] (0,0) -- (0.5,0) node[right]footnotesize(y);
draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
endtikzpicture
hspace-1cm
includegraphics[width=0.45textwidth,height=1cm]example-image-a
quad
subfloat[]%
begintikzpicture
draw [->] (0,0) -- (0.5,0) node[right]footnotesize(y);
draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
endtikzpicture
hspace-1cm
includegraphics[width=0.45textwidth,height=1cm]example-image-a
\
subfloat[]%
includegraphics[width=0.45textwidth,height=1cm]example-image-a
hspace-0.9cm
begintikzpicture
draw [->] (0,0) -- (-0.5,0) node[left]footnotesize(y);
draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
endtikzpicture
quad
subfloat[]%
includegraphics[width=0.45textwidth,height=1cm]example-image-a
hspace-0.9cm
begintikzpicture
draw [->] (0,0) -- (-0.5,0) node[left]footnotesize(y);
draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
endtikzpicture
captionFoo
endfigure
enddocument


EDIT I would like the axes to be something like this:



enter image description here










share|improve this question




























    3















    I need to add axes to a bunch of figures in my document, I'm trying with tikz but maybe there's an easier and more elegant way to do it (looking at you, overpic)?
    The result I'm trying to achieve is not like this, I need the axes to have the arrows as well.



    I got some MWE working, but the axes are vertically misaligned (they should be outside of the picture). I've tryed adding vspaces but they don't seem to work as I'd like.



    Thanks in advance for your help!



    MWE:



    output



    documentclassscrreprt
    usepackagesubfig
    usepackagegraphicx
    usepackagetikz
    begindocument
    beginfigure[h!]
    vspace-0.6cm
    centering
    subfloat[]%
    begintikzpicture
    draw [->] (0,0) -- (0.5,0) node[right]footnotesize(y);
    draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
    endtikzpicture
    hspace-1cm
    includegraphics[width=0.45textwidth,height=1cm]example-image-a
    quad
    subfloat[]%
    begintikzpicture
    draw [->] (0,0) -- (0.5,0) node[right]footnotesize(y);
    draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
    endtikzpicture
    hspace-1cm
    includegraphics[width=0.45textwidth,height=1cm]example-image-a
    \
    subfloat[]%
    includegraphics[width=0.45textwidth,height=1cm]example-image-a
    hspace-0.9cm
    begintikzpicture
    draw [->] (0,0) -- (-0.5,0) node[left]footnotesize(y);
    draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
    endtikzpicture
    quad
    subfloat[]%
    includegraphics[width=0.45textwidth,height=1cm]example-image-a
    hspace-0.9cm
    begintikzpicture
    draw [->] (0,0) -- (-0.5,0) node[left]footnotesize(y);
    draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
    endtikzpicture
    captionFoo
    endfigure
    enddocument


    EDIT I would like the axes to be something like this:



    enter image description here










    share|improve this question


























      3












      3








      3








      I need to add axes to a bunch of figures in my document, I'm trying with tikz but maybe there's an easier and more elegant way to do it (looking at you, overpic)?
      The result I'm trying to achieve is not like this, I need the axes to have the arrows as well.



      I got some MWE working, but the axes are vertically misaligned (they should be outside of the picture). I've tryed adding vspaces but they don't seem to work as I'd like.



      Thanks in advance for your help!



      MWE:



      output



      documentclassscrreprt
      usepackagesubfig
      usepackagegraphicx
      usepackagetikz
      begindocument
      beginfigure[h!]
      vspace-0.6cm
      centering
      subfloat[]%
      begintikzpicture
      draw [->] (0,0) -- (0.5,0) node[right]footnotesize(y);
      draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
      endtikzpicture
      hspace-1cm
      includegraphics[width=0.45textwidth,height=1cm]example-image-a
      quad
      subfloat[]%
      begintikzpicture
      draw [->] (0,0) -- (0.5,0) node[right]footnotesize(y);
      draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
      endtikzpicture
      hspace-1cm
      includegraphics[width=0.45textwidth,height=1cm]example-image-a
      \
      subfloat[]%
      includegraphics[width=0.45textwidth,height=1cm]example-image-a
      hspace-0.9cm
      begintikzpicture
      draw [->] (0,0) -- (-0.5,0) node[left]footnotesize(y);
      draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
      endtikzpicture
      quad
      subfloat[]%
      includegraphics[width=0.45textwidth,height=1cm]example-image-a
      hspace-0.9cm
      begintikzpicture
      draw [->] (0,0) -- (-0.5,0) node[left]footnotesize(y);
      draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
      endtikzpicture
      captionFoo
      endfigure
      enddocument


      EDIT I would like the axes to be something like this:



      enter image description here










      share|improve this question
















      I need to add axes to a bunch of figures in my document, I'm trying with tikz but maybe there's an easier and more elegant way to do it (looking at you, overpic)?
      The result I'm trying to achieve is not like this, I need the axes to have the arrows as well.



      I got some MWE working, but the axes are vertically misaligned (they should be outside of the picture). I've tryed adding vspaces but they don't seem to work as I'd like.



      Thanks in advance for your help!



      MWE:



      output



      documentclassscrreprt
      usepackagesubfig
      usepackagegraphicx
      usepackagetikz
      begindocument
      beginfigure[h!]
      vspace-0.6cm
      centering
      subfloat[]%
      begintikzpicture
      draw [->] (0,0) -- (0.5,0) node[right]footnotesize(y);
      draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
      endtikzpicture
      hspace-1cm
      includegraphics[width=0.45textwidth,height=1cm]example-image-a
      quad
      subfloat[]%
      begintikzpicture
      draw [->] (0,0) -- (0.5,0) node[right]footnotesize(y);
      draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
      endtikzpicture
      hspace-1cm
      includegraphics[width=0.45textwidth,height=1cm]example-image-a
      \
      subfloat[]%
      includegraphics[width=0.45textwidth,height=1cm]example-image-a
      hspace-0.9cm
      begintikzpicture
      draw [->] (0,0) -- (-0.5,0) node[left]footnotesize(y);
      draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
      endtikzpicture
      quad
      subfloat[]%
      includegraphics[width=0.45textwidth,height=1cm]example-image-a
      hspace-0.9cm
      begintikzpicture
      draw [->] (0,0) -- (-0.5,0) node[left]footnotesize(y);
      draw [->] (0,0) -- (0,0.5) node[above]footnotesize(x);
      endtikzpicture
      captionFoo
      endfigure
      enddocument


      EDIT I would like the axes to be something like this:



      enter image description here







      tikz-pgf floats subfloats overpic






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 19 at 10:27







      Superuser27

















      asked Mar 19 at 10:04









      Superuser27Superuser27

      71516




      71516




















          2 Answers
          2






          active

          oldest

          votes


















          4














          If you don't want to use the heavy tikz weapons, picture mode is sufficient to draw a few arrows:



          documentclassscrreprt
          usepackagesubfig
          usepackagegraphicx
          %usepackagetikz
          begindocument
          beginfigure[htbp]
          vspace-0.6cm
          centering
          subfloat[]%
          setlengthunitlengthtextwidth
          beginpicture(.45,0.1)
          put(0,0)includegraphics[width=0.45textwidth,height=1cm]example-image-a
          put(.46,-.01)vector(-1,0).07
          put(.46,-.01)vector(0,1).05
          put(.453,.045)x
          put(.373,-.014)y
          endpicture

          captionFoo
          endfigure
          enddocument


          enter image description here



          Second approach with the heavy tikz weapons:



          documentclassscrreprt
          usepackagesubfig
          usepackagegraphicx
          usepackagetikz
          begindocument
          beginfigure[htbp]
          vspace-0.6cm
          centering
          subfloat[]%
          begintikzpicture
          node (image) at (0,0) includegraphics[width=0.45textwidth,height=1cm]example-image-a;
          draw [->] (image.south west) -- ++(0.5,0) node[right]footnotesizetextity;
          draw [->] (image.south west) -- ++(0,0.5) node[above]footnotesizetextitx;
          endtikzpicture

          endfigure
          enddocument


          enter image description here



          Off-topic: I would not use [h!] as floating specifier, this is almost always a guarantee for bad image placement






          share|improve this answer

























          • I need the axes to be lower, both outside of the picture

            – Superuser27
            Mar 19 at 10:16






          • 2





            @Superuser27 You can move the arrows wherever you want

            – samcarter
            Mar 19 at 10:18











          • @Superuser27 Can you make a sketch where you want your axis to be?

            – samcarter
            Mar 19 at 10:24











          • So for the labels (put(.545,.07)x put(.46,.007)y) I just have to try around with the numbers until they are in the right position? Is there no easier way to position them relative to the picture maybe? Or just add labels to the vectors like with tikz?

            – Superuser27
            Mar 19 at 10:24






          • 1





            @Superuser27 Sure, you can change the inner sep. For example begintikzpicture[inner sep=10pt]

            – samcarter
            Mar 20 at 17:27


















          0














          Maybe like this?



          mwe



          documentclassarticle
          begindocument
          <<test,echo=F,fig.cap="Axis with background image and more.">>=
          library(png)
          ima <- readPNG("/usr/local/texlive/2018/texmf-dist/tex/latex/mwe/example-image-a.png")
          plot(1:2, type='n', xlab="x", ylab="y",xlim=c(0,10),ylim=c(0,7.5),axes=F)
          lim <- par()
          u <- par("usr")
          rasterImage(ima, u[1]+.5, u[3]+.5, u[2]-.5, u[4]-.5)
          arrows(u[1], u[3], u[2], u[3], code = 2, xpd = TRUE)
          arrows(u[1], u[3], u[1], u[4], code = 2, xpd = TRUE)
          lines(c(1, 1.2, 1.35,4.5, 6, 8.3, 9.5), c(.6, 1.3, 0.9,2.7, 0.6, 4.7, 7.0), lwd=5, col="blue")
          @
          enddocument


          Of course, this need R and knitr to be compiled.



          If you need only a little axis:



          mwe2



          documentclassarticle
          begindocument
          <<test,echo=F,fig.cap="Axis with background image and more.">>=
          library(png)
          ima <- readPNG("/usr/local/texlive/2018/texmf-dist/tex/latex/mwe/example-image-a.png")
          plot(1:2, type='n', xlab="", ylab="",xlim=c(0,10),ylim=c(0,7.5),axes=F)
          lim <- par()
          u <- par("usr")
          rasterImage(ima, u[1]+.5, u[3]+.5, u[2]-.5, u[4]-.5)
          arrows(u[1], u[3], u[2]/3, u[3], code = 2, xpd = TRUE)
          arrows(u[1], u[3], u[1], u[4]/3, code = 2, xpd = TRUE)
          axis(1, at=u[2]/6, tck=0, labels="x")
          axis(2, at=u[4]/6, tck=0, labels="y")
          lines(c(1, 1.2, 1.35,4.5, 6, 8.3, 9.5), c(.6, 1.3, 0.9,2.7, 0.6, 4.7, 7.0), lwd=5, col="blue")
          @
          enddocument





          share|improve this answer

























          • What code is this? :D never seen it... Actually I don't need to plot anything on the figure, I just need the axes.

            – Superuser27
            Mar 19 at 13:01











          • @Superuser27 It is R code embedded in a LateX file (.Rnw) , that knitr (a R package) export to a true/pure LateX file (.tex) that can be compiled as usual . With R (free) and RStudio editor (free) installed, all the process is simply push the "Compile PDF" button. With respect to the unwanted blue line, simply remove the row lines(c(1, ....

            – Fran
            Mar 19 at 13:17











          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%2f480235%2fadding-axes-to-figures%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          If you don't want to use the heavy tikz weapons, picture mode is sufficient to draw a few arrows:



          documentclassscrreprt
          usepackagesubfig
          usepackagegraphicx
          %usepackagetikz
          begindocument
          beginfigure[htbp]
          vspace-0.6cm
          centering
          subfloat[]%
          setlengthunitlengthtextwidth
          beginpicture(.45,0.1)
          put(0,0)includegraphics[width=0.45textwidth,height=1cm]example-image-a
          put(.46,-.01)vector(-1,0).07
          put(.46,-.01)vector(0,1).05
          put(.453,.045)x
          put(.373,-.014)y
          endpicture

          captionFoo
          endfigure
          enddocument


          enter image description here



          Second approach with the heavy tikz weapons:



          documentclassscrreprt
          usepackagesubfig
          usepackagegraphicx
          usepackagetikz
          begindocument
          beginfigure[htbp]
          vspace-0.6cm
          centering
          subfloat[]%
          begintikzpicture
          node (image) at (0,0) includegraphics[width=0.45textwidth,height=1cm]example-image-a;
          draw [->] (image.south west) -- ++(0.5,0) node[right]footnotesizetextity;
          draw [->] (image.south west) -- ++(0,0.5) node[above]footnotesizetextitx;
          endtikzpicture

          endfigure
          enddocument


          enter image description here



          Off-topic: I would not use [h!] as floating specifier, this is almost always a guarantee for bad image placement






          share|improve this answer

























          • I need the axes to be lower, both outside of the picture

            – Superuser27
            Mar 19 at 10:16






          • 2





            @Superuser27 You can move the arrows wherever you want

            – samcarter
            Mar 19 at 10:18











          • @Superuser27 Can you make a sketch where you want your axis to be?

            – samcarter
            Mar 19 at 10:24











          • So for the labels (put(.545,.07)x put(.46,.007)y) I just have to try around with the numbers until they are in the right position? Is there no easier way to position them relative to the picture maybe? Or just add labels to the vectors like with tikz?

            – Superuser27
            Mar 19 at 10:24






          • 1





            @Superuser27 Sure, you can change the inner sep. For example begintikzpicture[inner sep=10pt]

            – samcarter
            Mar 20 at 17:27















          4














          If you don't want to use the heavy tikz weapons, picture mode is sufficient to draw a few arrows:



          documentclassscrreprt
          usepackagesubfig
          usepackagegraphicx
          %usepackagetikz
          begindocument
          beginfigure[htbp]
          vspace-0.6cm
          centering
          subfloat[]%
          setlengthunitlengthtextwidth
          beginpicture(.45,0.1)
          put(0,0)includegraphics[width=0.45textwidth,height=1cm]example-image-a
          put(.46,-.01)vector(-1,0).07
          put(.46,-.01)vector(0,1).05
          put(.453,.045)x
          put(.373,-.014)y
          endpicture

          captionFoo
          endfigure
          enddocument


          enter image description here



          Second approach with the heavy tikz weapons:



          documentclassscrreprt
          usepackagesubfig
          usepackagegraphicx
          usepackagetikz
          begindocument
          beginfigure[htbp]
          vspace-0.6cm
          centering
          subfloat[]%
          begintikzpicture
          node (image) at (0,0) includegraphics[width=0.45textwidth,height=1cm]example-image-a;
          draw [->] (image.south west) -- ++(0.5,0) node[right]footnotesizetextity;
          draw [->] (image.south west) -- ++(0,0.5) node[above]footnotesizetextitx;
          endtikzpicture

          endfigure
          enddocument


          enter image description here



          Off-topic: I would not use [h!] as floating specifier, this is almost always a guarantee for bad image placement






          share|improve this answer

























          • I need the axes to be lower, both outside of the picture

            – Superuser27
            Mar 19 at 10:16






          • 2





            @Superuser27 You can move the arrows wherever you want

            – samcarter
            Mar 19 at 10:18











          • @Superuser27 Can you make a sketch where you want your axis to be?

            – samcarter
            Mar 19 at 10:24











          • So for the labels (put(.545,.07)x put(.46,.007)y) I just have to try around with the numbers until they are in the right position? Is there no easier way to position them relative to the picture maybe? Or just add labels to the vectors like with tikz?

            – Superuser27
            Mar 19 at 10:24






          • 1





            @Superuser27 Sure, you can change the inner sep. For example begintikzpicture[inner sep=10pt]

            – samcarter
            Mar 20 at 17:27













          4












          4








          4







          If you don't want to use the heavy tikz weapons, picture mode is sufficient to draw a few arrows:



          documentclassscrreprt
          usepackagesubfig
          usepackagegraphicx
          %usepackagetikz
          begindocument
          beginfigure[htbp]
          vspace-0.6cm
          centering
          subfloat[]%
          setlengthunitlengthtextwidth
          beginpicture(.45,0.1)
          put(0,0)includegraphics[width=0.45textwidth,height=1cm]example-image-a
          put(.46,-.01)vector(-1,0).07
          put(.46,-.01)vector(0,1).05
          put(.453,.045)x
          put(.373,-.014)y
          endpicture

          captionFoo
          endfigure
          enddocument


          enter image description here



          Second approach with the heavy tikz weapons:



          documentclassscrreprt
          usepackagesubfig
          usepackagegraphicx
          usepackagetikz
          begindocument
          beginfigure[htbp]
          vspace-0.6cm
          centering
          subfloat[]%
          begintikzpicture
          node (image) at (0,0) includegraphics[width=0.45textwidth,height=1cm]example-image-a;
          draw [->] (image.south west) -- ++(0.5,0) node[right]footnotesizetextity;
          draw [->] (image.south west) -- ++(0,0.5) node[above]footnotesizetextitx;
          endtikzpicture

          endfigure
          enddocument


          enter image description here



          Off-topic: I would not use [h!] as floating specifier, this is almost always a guarantee for bad image placement






          share|improve this answer















          If you don't want to use the heavy tikz weapons, picture mode is sufficient to draw a few arrows:



          documentclassscrreprt
          usepackagesubfig
          usepackagegraphicx
          %usepackagetikz
          begindocument
          beginfigure[htbp]
          vspace-0.6cm
          centering
          subfloat[]%
          setlengthunitlengthtextwidth
          beginpicture(.45,0.1)
          put(0,0)includegraphics[width=0.45textwidth,height=1cm]example-image-a
          put(.46,-.01)vector(-1,0).07
          put(.46,-.01)vector(0,1).05
          put(.453,.045)x
          put(.373,-.014)y
          endpicture

          captionFoo
          endfigure
          enddocument


          enter image description here



          Second approach with the heavy tikz weapons:



          documentclassscrreprt
          usepackagesubfig
          usepackagegraphicx
          usepackagetikz
          begindocument
          beginfigure[htbp]
          vspace-0.6cm
          centering
          subfloat[]%
          begintikzpicture
          node (image) at (0,0) includegraphics[width=0.45textwidth,height=1cm]example-image-a;
          draw [->] (image.south west) -- ++(0.5,0) node[right]footnotesizetextity;
          draw [->] (image.south west) -- ++(0,0.5) node[above]footnotesizetextitx;
          endtikzpicture

          endfigure
          enddocument


          enter image description here



          Off-topic: I would not use [h!] as floating specifier, this is almost always a guarantee for bad image placement







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 19 at 10:36

























          answered Mar 19 at 10:13









          samcartersamcarter

          92.8k7105299




          92.8k7105299












          • I need the axes to be lower, both outside of the picture

            – Superuser27
            Mar 19 at 10:16






          • 2





            @Superuser27 You can move the arrows wherever you want

            – samcarter
            Mar 19 at 10:18











          • @Superuser27 Can you make a sketch where you want your axis to be?

            – samcarter
            Mar 19 at 10:24











          • So for the labels (put(.545,.07)x put(.46,.007)y) I just have to try around with the numbers until they are in the right position? Is there no easier way to position them relative to the picture maybe? Or just add labels to the vectors like with tikz?

            – Superuser27
            Mar 19 at 10:24






          • 1





            @Superuser27 Sure, you can change the inner sep. For example begintikzpicture[inner sep=10pt]

            – samcarter
            Mar 20 at 17:27

















          • I need the axes to be lower, both outside of the picture

            – Superuser27
            Mar 19 at 10:16






          • 2





            @Superuser27 You can move the arrows wherever you want

            – samcarter
            Mar 19 at 10:18











          • @Superuser27 Can you make a sketch where you want your axis to be?

            – samcarter
            Mar 19 at 10:24











          • So for the labels (put(.545,.07)x put(.46,.007)y) I just have to try around with the numbers until they are in the right position? Is there no easier way to position them relative to the picture maybe? Or just add labels to the vectors like with tikz?

            – Superuser27
            Mar 19 at 10:24






          • 1





            @Superuser27 Sure, you can change the inner sep. For example begintikzpicture[inner sep=10pt]

            – samcarter
            Mar 20 at 17:27
















          I need the axes to be lower, both outside of the picture

          – Superuser27
          Mar 19 at 10:16





          I need the axes to be lower, both outside of the picture

          – Superuser27
          Mar 19 at 10:16




          2




          2





          @Superuser27 You can move the arrows wherever you want

          – samcarter
          Mar 19 at 10:18





          @Superuser27 You can move the arrows wherever you want

          – samcarter
          Mar 19 at 10:18













          @Superuser27 Can you make a sketch where you want your axis to be?

          – samcarter
          Mar 19 at 10:24





          @Superuser27 Can you make a sketch where you want your axis to be?

          – samcarter
          Mar 19 at 10:24













          So for the labels (put(.545,.07)x put(.46,.007)y) I just have to try around with the numbers until they are in the right position? Is there no easier way to position them relative to the picture maybe? Or just add labels to the vectors like with tikz?

          – Superuser27
          Mar 19 at 10:24





          So for the labels (put(.545,.07)x put(.46,.007)y) I just have to try around with the numbers until they are in the right position? Is there no easier way to position them relative to the picture maybe? Or just add labels to the vectors like with tikz?

          – Superuser27
          Mar 19 at 10:24




          1




          1





          @Superuser27 Sure, you can change the inner sep. For example begintikzpicture[inner sep=10pt]

          – samcarter
          Mar 20 at 17:27





          @Superuser27 Sure, you can change the inner sep. For example begintikzpicture[inner sep=10pt]

          – samcarter
          Mar 20 at 17:27











          0














          Maybe like this?



          mwe



          documentclassarticle
          begindocument
          <<test,echo=F,fig.cap="Axis with background image and more.">>=
          library(png)
          ima <- readPNG("/usr/local/texlive/2018/texmf-dist/tex/latex/mwe/example-image-a.png")
          plot(1:2, type='n', xlab="x", ylab="y",xlim=c(0,10),ylim=c(0,7.5),axes=F)
          lim <- par()
          u <- par("usr")
          rasterImage(ima, u[1]+.5, u[3]+.5, u[2]-.5, u[4]-.5)
          arrows(u[1], u[3], u[2], u[3], code = 2, xpd = TRUE)
          arrows(u[1], u[3], u[1], u[4], code = 2, xpd = TRUE)
          lines(c(1, 1.2, 1.35,4.5, 6, 8.3, 9.5), c(.6, 1.3, 0.9,2.7, 0.6, 4.7, 7.0), lwd=5, col="blue")
          @
          enddocument


          Of course, this need R and knitr to be compiled.



          If you need only a little axis:



          mwe2



          documentclassarticle
          begindocument
          <<test,echo=F,fig.cap="Axis with background image and more.">>=
          library(png)
          ima <- readPNG("/usr/local/texlive/2018/texmf-dist/tex/latex/mwe/example-image-a.png")
          plot(1:2, type='n', xlab="", ylab="",xlim=c(0,10),ylim=c(0,7.5),axes=F)
          lim <- par()
          u <- par("usr")
          rasterImage(ima, u[1]+.5, u[3]+.5, u[2]-.5, u[4]-.5)
          arrows(u[1], u[3], u[2]/3, u[3], code = 2, xpd = TRUE)
          arrows(u[1], u[3], u[1], u[4]/3, code = 2, xpd = TRUE)
          axis(1, at=u[2]/6, tck=0, labels="x")
          axis(2, at=u[4]/6, tck=0, labels="y")
          lines(c(1, 1.2, 1.35,4.5, 6, 8.3, 9.5), c(.6, 1.3, 0.9,2.7, 0.6, 4.7, 7.0), lwd=5, col="blue")
          @
          enddocument





          share|improve this answer

























          • What code is this? :D never seen it... Actually I don't need to plot anything on the figure, I just need the axes.

            – Superuser27
            Mar 19 at 13:01











          • @Superuser27 It is R code embedded in a LateX file (.Rnw) , that knitr (a R package) export to a true/pure LateX file (.tex) that can be compiled as usual . With R (free) and RStudio editor (free) installed, all the process is simply push the "Compile PDF" button. With respect to the unwanted blue line, simply remove the row lines(c(1, ....

            – Fran
            Mar 19 at 13:17
















          0














          Maybe like this?



          mwe



          documentclassarticle
          begindocument
          <<test,echo=F,fig.cap="Axis with background image and more.">>=
          library(png)
          ima <- readPNG("/usr/local/texlive/2018/texmf-dist/tex/latex/mwe/example-image-a.png")
          plot(1:2, type='n', xlab="x", ylab="y",xlim=c(0,10),ylim=c(0,7.5),axes=F)
          lim <- par()
          u <- par("usr")
          rasterImage(ima, u[1]+.5, u[3]+.5, u[2]-.5, u[4]-.5)
          arrows(u[1], u[3], u[2], u[3], code = 2, xpd = TRUE)
          arrows(u[1], u[3], u[1], u[4], code = 2, xpd = TRUE)
          lines(c(1, 1.2, 1.35,4.5, 6, 8.3, 9.5), c(.6, 1.3, 0.9,2.7, 0.6, 4.7, 7.0), lwd=5, col="blue")
          @
          enddocument


          Of course, this need R and knitr to be compiled.



          If you need only a little axis:



          mwe2



          documentclassarticle
          begindocument
          <<test,echo=F,fig.cap="Axis with background image and more.">>=
          library(png)
          ima <- readPNG("/usr/local/texlive/2018/texmf-dist/tex/latex/mwe/example-image-a.png")
          plot(1:2, type='n', xlab="", ylab="",xlim=c(0,10),ylim=c(0,7.5),axes=F)
          lim <- par()
          u <- par("usr")
          rasterImage(ima, u[1]+.5, u[3]+.5, u[2]-.5, u[4]-.5)
          arrows(u[1], u[3], u[2]/3, u[3], code = 2, xpd = TRUE)
          arrows(u[1], u[3], u[1], u[4]/3, code = 2, xpd = TRUE)
          axis(1, at=u[2]/6, tck=0, labels="x")
          axis(2, at=u[4]/6, tck=0, labels="y")
          lines(c(1, 1.2, 1.35,4.5, 6, 8.3, 9.5), c(.6, 1.3, 0.9,2.7, 0.6, 4.7, 7.0), lwd=5, col="blue")
          @
          enddocument





          share|improve this answer

























          • What code is this? :D never seen it... Actually I don't need to plot anything on the figure, I just need the axes.

            – Superuser27
            Mar 19 at 13:01











          • @Superuser27 It is R code embedded in a LateX file (.Rnw) , that knitr (a R package) export to a true/pure LateX file (.tex) that can be compiled as usual . With R (free) and RStudio editor (free) installed, all the process is simply push the "Compile PDF" button. With respect to the unwanted blue line, simply remove the row lines(c(1, ....

            – Fran
            Mar 19 at 13:17














          0












          0








          0







          Maybe like this?



          mwe



          documentclassarticle
          begindocument
          <<test,echo=F,fig.cap="Axis with background image and more.">>=
          library(png)
          ima <- readPNG("/usr/local/texlive/2018/texmf-dist/tex/latex/mwe/example-image-a.png")
          plot(1:2, type='n', xlab="x", ylab="y",xlim=c(0,10),ylim=c(0,7.5),axes=F)
          lim <- par()
          u <- par("usr")
          rasterImage(ima, u[1]+.5, u[3]+.5, u[2]-.5, u[4]-.5)
          arrows(u[1], u[3], u[2], u[3], code = 2, xpd = TRUE)
          arrows(u[1], u[3], u[1], u[4], code = 2, xpd = TRUE)
          lines(c(1, 1.2, 1.35,4.5, 6, 8.3, 9.5), c(.6, 1.3, 0.9,2.7, 0.6, 4.7, 7.0), lwd=5, col="blue")
          @
          enddocument


          Of course, this need R and knitr to be compiled.



          If you need only a little axis:



          mwe2



          documentclassarticle
          begindocument
          <<test,echo=F,fig.cap="Axis with background image and more.">>=
          library(png)
          ima <- readPNG("/usr/local/texlive/2018/texmf-dist/tex/latex/mwe/example-image-a.png")
          plot(1:2, type='n', xlab="", ylab="",xlim=c(0,10),ylim=c(0,7.5),axes=F)
          lim <- par()
          u <- par("usr")
          rasterImage(ima, u[1]+.5, u[3]+.5, u[2]-.5, u[4]-.5)
          arrows(u[1], u[3], u[2]/3, u[3], code = 2, xpd = TRUE)
          arrows(u[1], u[3], u[1], u[4]/3, code = 2, xpd = TRUE)
          axis(1, at=u[2]/6, tck=0, labels="x")
          axis(2, at=u[4]/6, tck=0, labels="y")
          lines(c(1, 1.2, 1.35,4.5, 6, 8.3, 9.5), c(.6, 1.3, 0.9,2.7, 0.6, 4.7, 7.0), lwd=5, col="blue")
          @
          enddocument





          share|improve this answer















          Maybe like this?



          mwe



          documentclassarticle
          begindocument
          <<test,echo=F,fig.cap="Axis with background image and more.">>=
          library(png)
          ima <- readPNG("/usr/local/texlive/2018/texmf-dist/tex/latex/mwe/example-image-a.png")
          plot(1:2, type='n', xlab="x", ylab="y",xlim=c(0,10),ylim=c(0,7.5),axes=F)
          lim <- par()
          u <- par("usr")
          rasterImage(ima, u[1]+.5, u[3]+.5, u[2]-.5, u[4]-.5)
          arrows(u[1], u[3], u[2], u[3], code = 2, xpd = TRUE)
          arrows(u[1], u[3], u[1], u[4], code = 2, xpd = TRUE)
          lines(c(1, 1.2, 1.35,4.5, 6, 8.3, 9.5), c(.6, 1.3, 0.9,2.7, 0.6, 4.7, 7.0), lwd=5, col="blue")
          @
          enddocument


          Of course, this need R and knitr to be compiled.



          If you need only a little axis:



          mwe2



          documentclassarticle
          begindocument
          <<test,echo=F,fig.cap="Axis with background image and more.">>=
          library(png)
          ima <- readPNG("/usr/local/texlive/2018/texmf-dist/tex/latex/mwe/example-image-a.png")
          plot(1:2, type='n', xlab="", ylab="",xlim=c(0,10),ylim=c(0,7.5),axes=F)
          lim <- par()
          u <- par("usr")
          rasterImage(ima, u[1]+.5, u[3]+.5, u[2]-.5, u[4]-.5)
          arrows(u[1], u[3], u[2]/3, u[3], code = 2, xpd = TRUE)
          arrows(u[1], u[3], u[1], u[4]/3, code = 2, xpd = TRUE)
          axis(1, at=u[2]/6, tck=0, labels="x")
          axis(2, at=u[4]/6, tck=0, labels="y")
          lines(c(1, 1.2, 1.35,4.5, 6, 8.3, 9.5), c(.6, 1.3, 0.9,2.7, 0.6, 4.7, 7.0), lwd=5, col="blue")
          @
          enddocument






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 19 at 11:34

























          answered Mar 19 at 10:57









          FranFran

          53.2k6119183




          53.2k6119183












          • What code is this? :D never seen it... Actually I don't need to plot anything on the figure, I just need the axes.

            – Superuser27
            Mar 19 at 13:01











          • @Superuser27 It is R code embedded in a LateX file (.Rnw) , that knitr (a R package) export to a true/pure LateX file (.tex) that can be compiled as usual . With R (free) and RStudio editor (free) installed, all the process is simply push the "Compile PDF" button. With respect to the unwanted blue line, simply remove the row lines(c(1, ....

            – Fran
            Mar 19 at 13:17


















          • What code is this? :D never seen it... Actually I don't need to plot anything on the figure, I just need the axes.

            – Superuser27
            Mar 19 at 13:01











          • @Superuser27 It is R code embedded in a LateX file (.Rnw) , that knitr (a R package) export to a true/pure LateX file (.tex) that can be compiled as usual . With R (free) and RStudio editor (free) installed, all the process is simply push the "Compile PDF" button. With respect to the unwanted blue line, simply remove the row lines(c(1, ....

            – Fran
            Mar 19 at 13:17

















          What code is this? :D never seen it... Actually I don't need to plot anything on the figure, I just need the axes.

          – Superuser27
          Mar 19 at 13:01





          What code is this? :D never seen it... Actually I don't need to plot anything on the figure, I just need the axes.

          – Superuser27
          Mar 19 at 13:01













          @Superuser27 It is R code embedded in a LateX file (.Rnw) , that knitr (a R package) export to a true/pure LateX file (.tex) that can be compiled as usual . With R (free) and RStudio editor (free) installed, all the process is simply push the "Compile PDF" button. With respect to the unwanted blue line, simply remove the row lines(c(1, ....

          – Fran
          Mar 19 at 13:17






          @Superuser27 It is R code embedded in a LateX file (.Rnw) , that knitr (a R package) export to a true/pure LateX file (.tex) that can be compiled as usual . With R (free) and RStudio editor (free) installed, all the process is simply push the "Compile PDF" button. With respect to the unwanted blue line, simply remove the row lines(c(1, ....

          – Fran
          Mar 19 at 13:17


















          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%2f480235%2fadding-axes-to-figures%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

          Luettelo Yhdysvaltain laivaston lentotukialuksista Lähteet | Navigointivalikko

          Gary (muusikko) Sisällysluettelo Historia | Rockin' High | Lähteet | Aiheesta muualla | NavigointivalikkoInfobox OKTuomas "Gary" Keskinen Ancaran kitaristiksiProjekti Rockin' High