答案1
一个选项是,另一个选项是和键groupplot
的组合,以将第一个相对于第二个进行定位。name
at
axis
\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\begin{document}
An example with the \texttt{groupplots} library:
\begin{tikzpicture}
\begin{groupplot}[
group style={
group size=2 by 1,
y descriptions at=edge left,
horizontal sep=2mm
},
scale only axis,
height=6cm,
ymin=0,ymax=7,
]
\nextgroupplot[width=2cm,xlabel=Something]
\addplot{5*rnd};
\nextgroupplot[width=6cm,xlabel=Else]
\addplot{4*rnd};
\end{groupplot}
\end{tikzpicture}
\bigskip
And by positioning one \texttt{axis} relative to the other.
\begin{tikzpicture}
\pgfplotsset{width=6cm}
\begin{axis}[name=Ax1,ymax=0.99] %ymax just for example
\addplot{rnd};
\end{axis}
\begin{axis}[name=Ax2,at={($(Ax1.north east)+(1cm,0)$)},anchor=north west]
\addplot{rnd};
\end{axis}
\end{tikzpicture}
\end{document}