In the picture below I want to overlay the xticklabel
$a$
and yticklabel
$f(a)$
in beamer
. Is it possible to overlay ticks labels?
If it's not possible, I can place de labels as nodes, but in that case, what are the defalult position of xticklabes
and yticklabes
in pgfplots
?
Thanks.
\documentclass{beamer}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis x line=middle,
axis y line=middle,
xtick={1},
xticklabels={$a$},
ytick={1},
yticklabels={$f(a)$},
]
\addplot+[domain=0:1.5, mark=none, smooth] {x^2} node[anchor=south] {$f(x)$};
\coordinate (O) at (0,0);
\coordinate (A) at (1,1);
\fill (A) circle (1.2pt);
\draw[gray, dotted] (A) -- (A|-O);
\draw[gray, dotted] (A) -- (A-|O);
\end{axis}
\end{tikzpicture}
\end{document}
Best Answer
Your plot has two problems at the moment:
f(x)
(and would cut away any nodes that you place outside). To avoid this, addclip=false
to the options of theaxis
environment.coordinate
s are currently defined intikzpicture
dimensions, not in the coordinate system of theaxis
environment. Replace(0,0)
by(axis cs:0,0)
and(1,1)
by(axis cs:1,1)
. Then your gray dotted lines will appear.If I interpret your question correctly, you want to have the labels appear gradually frame by frame. I don't think that
pgfplots
is able to cooperate withbeamer
directly, so you will need\node
and\only
commands.The plot will have different size in different frames, so it will jump. Therefore we have to set the bounding box explicitly to make it contain the plot in all frames.
The following output is generated from the code below.
Edit: Here is another solution that relies on
pgfplots
to position the labels. It is probably a better solution than the one above as long as it is possible to parametrize the plot by macros. It still needs\useasboundingbox
to avoid that the plot jumps.