¿Cómo se podría mover horizontal y verticalmente la trama en \groupplot?

¿Cómo se podría mover horizontal y verticalmente la trama en \groupplot?

Este es mi código:

\documentclass[tikz,12pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{mathptmx}    
\usetikzlibrary{pgfplots.groupplots}
\usepackage{pgfplots}
\pgfplotsset{width=12cm,compat=1.9}

\usepackage{filecontents}
\begin{filecontents}{1.csv}
400 0.02
450 0.03
500 0.035
550 0.08
600 0.1
650 0.05
700 0.15
750 0.12
800 0.02
850 0.05
900 0.1
\end{filecontents}
\begin{filecontents}{2.csv}
1   0.02
2   0.03
3 0.035
4   0.08
5   0.1
6 0.05
7   0.15
8 0.12
9   0.02
10  0.05
11  0.1
\end{filecontents}

\begin{document}
\pgfplotsset{every axis/.append style={
line width=.5 pt,
tick style={line width=.6pt}}}
\begin{tikzpicture}
\begin{groupplot}[group style={
        group size=2 by 1,
        vertical sep=-10cm,
        horizontal sep=-8.5cm,
    },]    
\nextgroupplot[
height=10cm,
xmin=400,
ymax=0.2,
enlarge x limits=.0,
enlarge y limits=.02,
ylabel={Absorption, A.U.},
xlabel={Wavelength, nm},
minor x tick num=4,
minor y tick num=4,
tick label style={/pgf/number format/fixed},
%xtick={200, 220, ...,360},
legend style={legend pos=north west,legend cell align=left,font=\tiny,draw=none,text height=0.1em},
]

\addplot[green] table [x index=0,y index=1] {1.csv};

\nextgroupplot[
font=\tiny,
height=5cm,
width=4cm,
ymax=0.12,
enlarge x limits=.0,
enlarge y limits=.02,
ylabel={Absorption at 740\,nm, A.U.},
xlabel={pH},
x label style={at={(axis description cs:0.5,-.05)},anchor=north},
y label style={at={(axis description cs:-0.2,.5)},anchor=south},
tick label style={/pgf/number format/fixed},
minor x tick num=4,
minor y tick num=4,
%xtick={200, 220, ...,360},
legend style={legend pos=north west,legend cell align=left,font=\tiny,draw=none,text height=0.1em},
]
\addplot[black,mark=*,dashed,line width=0.5pt] table [x index=0,y index=1] {2.csv};
\end{groupplot}
\end{tikzpicture}

\end{document}

Esto es lo que tengo:

ingrese la descripción de la imagen aquí

Quiero mover mi trama secundaria arriba. ¿Cómo se podría hacer? ¿Debo usarlo groupploto hay alguna otra forma de hacer lo que estoy tratando de hacer?

Respuesta1

En mi opinión, groupplotsno están realmente destinados a este tipo de cosas. Sugiero utilizar dos axisentornos en su lugar. Coloque a \coordinateen el eje mayor usando el sistema de coordenadas rel axis cso axis csy coloque el eje menor en esta coordenada.

En el código siguiente verás

\coordinate (otheraxis) at (rel axis cs:0.15,0.5);

en el primero axis, y en las opciones al segundo eje.

at={(otheraxis)},

que coloca la esquina inferior izquierda de axisen otheraxis. Esto le permite mover el eje más pequeño fácilmente modificando la otheraxiscoordenada.

\documentclass[tikz,12pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{mathptmx}    
\usetikzlibrary{pgfplots.groupplots}
\usepackage{pgfplots}
\pgfplotsset{width=12cm,compat=1.9}

\usepackage{filecontents}
\begin{filecontents}{1.csv}
400 0.02
450 0.03
500 0.035
550 0.08
600 0.1
650 0.05
700 0.15
750 0.12
800 0.02
850 0.05
900 0.1
\end{filecontents}
\begin{filecontents}{2.csv}
1   0.02
2   0.03
3 0.035
4   0.08
5   0.1
6 0.05
7   0.15
8 0.12
9   0.02
10  0.05
11  0.1
\end{filecontents}

\begin{document}
\pgfplotsset{every axis/.append style={
line width=.5 pt,
tick style={line width=.6pt}}}

\begin{tikzpicture}
\begin{axis}[
height=10cm,
xmin=400,
ymax=0.2,
enlarge x limits=.0,
enlarge y limits=.02,
ylabel={Absorption, A.U.},
xlabel={Wavelength, nm},
minor x tick num=4,
minor y tick num=4,
tick label style={/pgf/number format/fixed},
%xtick={200, 220, ...,360},
legend style={legend pos=north west,legend cell align=left,font=\tiny,draw=none,text height=0.1em},
]

\addplot[green] table [x index=0,y index=1] {1.csv};

\coordinate (otheraxis) at (rel axis cs:0.15,0.5);
\fill [red] (otheraxis) circle[radius=3pt];
\end{axis}

\begin{axis}[
at={(otheraxis)},
font=\tiny,
height=5cm,
width=4cm,
ymax=0.12,
enlarge x limits=.0,
enlarge y limits=.02,
ylabel={Absorption at 740\,nm, A.U.},
xlabel={pH},
x label style={at={(axis description cs:0.5,-.05)},anchor=north},
y label style={at={(axis description cs:-0.2,.5)},anchor=south},
tick label style={/pgf/number format/fixed},
minor x tick num=4,
minor y tick num=4,
%xtick={200, 220, ...,360},
legend style={legend pos=north west,legend cell align=left,font=\tiny,draw=none,text height=0.1em},
]
\addplot[black,mark=*,dashed,line width=0.5pt] table [x index=0,y index=1] {2.csv};
\end{axis}
\end{tikzpicture}

\end{document}

información relacionada