0

I have a question about placing pgfplots nodes with respect to page coordinates in a tikzgraphics. In particular, I am using beamer (this should not matter), but create the whole frame as a single tikzpicture. It is convenient to place the tikz nodes with respect to the "current page.north west" anchor.

I am having trouble doing the same for pgfplots axis nodes. How do I specify "current page.north west" for the "at" option to the axis environment?

There are several other questions here related to this, but they all use custom macros related to "\coordinate" which do not seem to work in my use case.

Thanks!

\documentclass[graphics]{beamer}

\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}
\begin{frame}
\begin{tikzpicture}[remember picture,overlay]
  % My nodes are placed with respect to the "current page.north west" anchor
  \node[anchor=north west,
        minimum width=5cm,
        minimum height=4cm,
        xshift=1cm,
        yshift=-1cm,
        outer sep=0,
        inner sep=0,
        fill=blue,
  ] at (current page.north west){};

  % How do I do the same thing for pgfplots nodes?
  \begin{axis}[
    anchor=north west,
    width=5cm,
    height=4cm,
    at={(0, 0)}, % what should I put here instead of "current page.north west"?
    xshift=1cm,
    yshift=1cm,
    scale only axis,
    axis background/.style={fill=green},
    ]
  \end{axis}

\end{tikzpicture}
\end{frame}
\end{document}

closed as off-topic by Max, Stefan Pinnow, siracusa, AlexG, TeXnician Sep 11 '18 at 10:51

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    at={(current page.north west)} should work. Note that it will not coincide with your \node because they have a different yshift. – Max Sep 11 '18 at 9:54
  • This works. My bad, I thought that I had tried exactly this several times. Must have been a typo on my end. Thanks! – sblatt Sep 11 '18 at 10:20
  • 1
    No problem. Possibly you forgot the parentheses, I believe those are required. – Max Sep 11 '18 at 10:21
  • 4
    I'm voting to close this question as off-topic because it is solved in the comments. – Max Sep 11 '18 at 10:22
1

As Max pointed out, simply putting

at={(current page.north west)},

fixes it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.