1

Is it possible put a code-made figure (not loaded externally) inside an axis environment? In barely words, a code-made figure in place of a "ordinary" plot. In this code, there is what I would like to:

\documentclass{amsart}
\usepackage{pgfplots}

\begin{document}

 \begin{tikzpicture}
  \begin{axis}[
  legend pos=outer north east,
  legend cell align={left},
  grid, grid style=dashed,
  ymin=0.75,ymax=1.02,
  ytick={0.78,0.81,0.84,0.87,0.90,0.93,0.96,0.99},
  xtick={0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1},
  extra y ticks={0.75},            % <---
  xmax=1.1,xmin=0,
  extra x ticks={0},            % <---
  axis lines = middle,
  set layers,                   % <---
  xlabel={$x$},ylabel={$y$}, 
  x label style={at={(1,0)},right},
  y label style={at={(0,1)},above},
  y tick label style={
        /pgf/number format/fixed,
        /pgf/number format/precision=2,
        /pgf/number format/fixed zerofill=true
    },
               ]
   %\begin{figure}
   % --some stuff
   %\end{figure}
\end{axis}
\end{tikzpicture}


\end{document}

Can you help me?

Thank you in advance

  • 3
    An axis still understands the usual tikz commands, so, yes, you can add a "code-made" tikzpicture into the axis , e.g. \draw (0.1,0.8) rectangle (1,0.9);. – Schrödinger's cat Nov 1 at 18:46
  • 1
    Putting a figure environment inside a tikzpicture makes no sense at all, did you really mean that? I don't think I quite understand what you want to do, but perhaps the previous comment answers your question. Note that unless you have compat=1.11 or higher, the coordinates will not correspond to the coordinates of the axis. – Torbjørn T. Nov 1 at 20:25
  • You should also check out axis cs: rel axis cs: and \pgfplotsextra in the pgfplots manual. – John Kormylo Nov 1 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.