Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This could be a second part to Positioning pgfplots axis in tikzpicture , I guess ; consider the following MWE:




\tikzstyle{nn} = [rectangle,draw,minimum width=4cm,minimum height=2cm,line width=1pt,inner sep=0pt]
\tikzstyle{ni} = [rectangle,draw,minimum width=2cm,minimum height=2cm,draw=red]

\node[nn,anchor=south west] (nodeOne) at (0,0) {One};
\node[nn,rotate=90] (nodeTwo) [right=6cm of nodeOne] {\emph{Two}} ;

  (nodeIndicator) [above right=0cm and 1.5cm of nodeOne] {} ;

%   at={(nodeOne)}, % passes
%   at={above right=0cm and 1.5cm of nodeOne}, % tikz Error: Cannot parse this coordinate.
  above right=0cm and 1.5cm of nodeOne, % passes, but wrong?
  inner sep=0pt,
\addplot coordinates { (0,0) (1,1) } ;

% graphical rulers in tikz - via grid:

% x ruler:
\draw[red] (0,0) grid[step=1cm] ({current bounding box.east|-(0cm,0.5cm);});
% y ruler:
\draw[red] (0,0) grid[step=1cm] ({current bounding box.north-|(0.5cm,0cm);});


It produces the following output:


It can be seen that the syntax above right=0cm and 1.5cm of nodeOne, due to the positioning library, works as expected in the case of nodeIndicator.

However, if I use the same construct in the {axis} environment, it is completely ignored! So my question is - how can I use positioning library syntax with the pgfplots {axis} environment?

Second - I just noticed this on this MWE - you can see that even if I specify width=4cm,height=3cm for the {axis} environment, the rendered plot is much smaller (that's why the rulers are added). What sort of size should the width and height refer to in the case of {axis} environment? (It's not the inner plot; neither it is inner plot+axes tick labels ... also related here: How to properly scale a TikZ/PGF picture which has a `\begin{axis}...\end{axis}`)

share|improve this question
About the size issue: By default, PGFPlots leaves space for the axis labels, that's why the plot area is smaller than the specified width and height. If you don't want that (because you don't have labels, for instance), use scale only axis. –  Jake Jun 25 at 17:44
Thanks for that, @Jake - good to know; cheers! –  sdaau Jun 26 at 3:44
1cm gets translated at 28.3pt which is the same as 28.3 to pgfmath. So it could just be off the page. –  John Kormylo Jun 26 at 4:11
Anyway, in tex.stackexchange.com/questions/172814/… I would name coordinates before \end{axis} and use them after. –  John Kormylo Jun 26 at 4:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.