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.

Is there any way to put axis environment at specific coordinates? For example if I want the function plot to be a secondary part of a big tikzpicture.

This is a MWE:

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\coordinate (coord) at (1,2);
\begin{axis}[anchor=(coord)]
\draw [blue,fill] (Point) circle (2pt) node [right] {(1,2)}
\end{axis}
\end{tikzpicture}
share|improve this question
    
This perfectly solves my problem! Thank you! –  skobls Jan 23 at 15:19
    
@Jake Sorry, didn't see your comment before I posted. If you want to write an answer yourself I can always delete mine. –  Torbjørn T. Jan 23 at 15:22
    
@TorbjørnT.: No problem at all! @ skobls: In addition to accepting the answer, please also upvote it by clicking the upward pointing triangle next to the answer. –  Jake Jan 23 at 15:26
    
@Jake: now I think he is allowed to :) –  Claudio Fiandrino Jan 23 at 15:29
    
Done. Thanks again, guys! –  skobls Jan 23 at 15:31

1 Answer 1

up vote 4 down vote accepted

Yes, you can specify at={<coordinate>} and the anchor in the axis options. In the following example the north east corner of the axis is placed in (10cm,5cm). I had to use units for the coordinate, unitless numbers didn't work.

\documentclass[tikz,border=2mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\draw (0,0) rectangle (10,5);

\begin{axis}[
  at={(10cm,5cm)},
  anchor={north east},
  width=5cm,
  height=4cm]
\addplot coordinates {(0,0) (1,1)};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

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

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