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:



  legend pos=outer north east,
  legend cell align={left},
  grid, grid style=dashed,
  extra y ticks={0.75},            % <---
  extra x ticks={0},            % <---
  axis lines = middle,
  set layers,                   % <---
  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
   % --some stuff


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.