我有一张图表,我想在其中放置另一张图表作为插图。我现在有以下代码,可在左下角创建一个插图。我怎样才能将插图移动到主图表的右上角或左上角?(使用 XeTeX 编译,因为我想要 Arial 格式的轴)。
\documentclass[tikz]{standalone}
\usepackage{amsmath}
\usepackage{mathspec}
\setmainfont{Arial}
\setmathrm{Arial} %To get the units in Arial
\setmathsfont(Latin,Greek,Digits){Arial}
\usepackage{pgfplots} %for drawing of graphs
\pgfplotsset{compat=1.3}
\begin{document}
\begin{tikzpicture}
\begin{axis}[]
\addplot[blue] table[x=X, y=Y] {test.dat};
\end{axis};
\begin{axis}[tiny]
\addplot[red] table[x=X, y=Z] {test.dat};
\end{axis};
\end{tikzpicture}
\end{document}
答案1
您可以命名并锚定轴以将它们彼此相对放置
\documentclass[tikz]{standalone}
\usepackage{mathspec}
\setmainfont{Arial}
\setmathrm{Arial} %To get the units in Arial
\setmathsfont(Latin,Greek,Digits){Arial}
\usepackage{pgfplots} %for drawing of graphs
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[name=big one]
\addplot[blue] {rand};
\end{axis}
\begin{axis}[tiny,anchor=north east,at={(big one.north east)}]
\addplot[red] {rand};
\end{axis}
\end{tikzpicture}
\end{document}