Conclusion
The original question, as Christian has pointed out, was far too broad and basically a result of being overwhelmed by the size of two main manuals for tikz
and pgfplots
and how they related to each other. The tikzpicture
is the main environment for creating graphics and so you should make a study of the Specifying Coordinates section of pgfmanual.pdf. The current version of tikz
is 2.10. The following is good if you're just starting out: Minimal Introduction To Tikz
If you're including a pgfplot
in your tikzpicture
then section 4.16 of pgfplots.pdf should be studied and in particular 4.16.1 explaining the axis cs
coordinate system. The current manual is version 1.8 and the current version of pgfplots
is 1.9.
I have left my original MWEs below to show what I was trying to do that solicited all the advice below. The first example has become redundant because I now know how to do curves in 3D with \addplot3
and that example is now rewritten entirely within a \begin{axis}
environment. See Positioning various types of node over a 3D Plot. None the less, the idea of placing tikzpicture
elements over an imported graphic background is still very important as you will want to use graphics that can't possibly be created totally within, such as a photo of an aeroplane upon which you're placing design descriptions.
The second example was about finding the most convenient way to place a LaTeX node over a pgfplot
. This is where percusse pointed out axis cs
and Jake pointed out you can scale the axis
rather than the whole tikzpicture
. Handling scaling when you have an imported background is still an open question for me. Scaling the background can get it out of step with what you've placed over it and I'm still not sure what is the best way to manage it.
One irony is that the node at
facility that I was initially having trouble with and was looking for an alternative, is now very useful to me. I just had to realise what it was actually doing and now I'm making good use of it. It's all part of the learning curve.
I was also using my own axis labels to deal with problems that were caused by using an outdated pgfplots
. These problems have been fixed in version 1.8.
Thanks to all who have commented.
MWE 1 Output
MWE 1 Imported Image
MWE 1 Code
\documentclass[12pt,a4paper,fleqn]{article}
\usepackage[a5paper,margin=14mm]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{pgfplots}
\usepackage{mathtools}
\def\dd{\,{\rm d}}
\def\nv{\mathbf{n}}
\begin{document}
%
\par\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0)
{\includegraphics[width=0.6\textwidth]{orient}};
\begin{scope}
[x={(image.south east)},y={(image.north west)}]
\path node at (.14, .03) {$x$} node at (.96, .49) {$y$}
node at (0.35, .95) {$z$} node at (.65, .03) {$\dd r$}
node at (.96, .17) {$\nv = (0, 1, 0)$} node at (0.65, 0.65) {$\dd s$};
\end{scope}
\end{tikzpicture}
%
\par\begin{tikzpicture}[scale=3]
\node[anchor=south west,inner sep=0] (image) at (0,0)
{\includegraphics[width=0.4\textwidth]{orient}};
\begin{scope}
[x={(image.south east)},y={(image.north west)},font=\footnotesize]
\path node at (.14, .03) {$x$} node at (.96, .49) {$y$}
node at (0.35, .95) {$z$} node at (.65, .03) {$\dd r$}
node at (.96, .17) {$\nv = (0, 1, 0)$} node at (0.65, 0.65) {$\dd s$};
\end{scope}
\end{tikzpicture}
%
\end{document}
MWE 2 Output
MWE 2 Code
\documentclass[10pt,a4paper,fleqn]{article}
\usepackage[a5paper,margin=14mm]{geometry}
\usepackage{pgfplots}
\usepackage{amsmath}
\begin{document}
%
\par\begin{tikzpicture}[scale=1.00]
%
\begin{axis}[
xtick={-1, 1, 3}, ytick={-8,-4, 4,8},
width=12cm, height=5cm,
axis lines=middle,
enlargelimits=true,
samples=201,
clip=false
]
\path node [xshift=9.2cm][yshift=1.1cm] {$t$}
node [xshift=2.0cm][yshift=3cm] {$y$};
\addplot [thick, color=green, domain=-1:0] ( {x}, {0} );
\addplot [thick, color=green, domain=0:4] ( {x}, {x^2*(2-x)*(4-x)^2} )
node [color=green, pos=.55][yshift=-1.8cm]
{$g(t)=\begin{cases}
0&-1\le t \le 0\\t^2(2-t)(4-t)^2&\hfill 0\le t \le4
\end{cases}$};
%
\end{axis}
%
\end{tikzpicture}
%
\end{document}
\node (<node name if required>) at (axis cs:<x axis coord>,<y axis coord>) {...};
wrt to the axis itself. – percusse Oct 17 '13 at 8:44\begin{axis}[scale=...]
instead of\begin{tikzpicture}[scale=...
, the "proper" label placement works. About your main question: I'm not entirely sure what issue you're encountering. Could you give an example of things that need adjustment when you scale the axis? And could you clarifiy what is meant by "placing everything without tedious amounts of trial and error"? – Jake Oct 17 '13 at 8:59\node
,axis
andcs
. What's pgf and what's tikz gets a bit blurred. I can't find your specific suggestion in either of them although there are elements of it. Any suggestions? Cheers – Geoff Pointer Oct 17 '13 at 10:37[pos=.55][yshift=-1.8cm]
didn't just fall out, I had to tweeze it around until it sat right. Even percusse's suggestion took me several tries before it sat right. – Geoff Pointer Oct 17 '13 at 10:43