Skip to content

Instantly share code, notes, and snippets.

@istitov
Last active December 19, 2015 17:08
Show Gist options
  • Save istitov/5988630 to your computer and use it in GitHub Desktop.
Save istitov/5988630 to your computer and use it in GitHub Desktop.
\begin{tikzpicture}
\begin{groupplot}[group style={columns=2,rows=2},]
\nextgroupplot[axis y line*=left,axis x line*=bottom,] % 1
\addplot[blue] coordinates {(0,2) (2,0)};
\nextgroupplot[axis y line*=left,axis x line*=bottom,] % 2
\addplot[blue] coordinates {(0,0) (3,3)};
\nextgroupplot[at=(group c1r1.north),axis y line*=right,axis x line*=top,] % 1, 2nd axis
\addplot[red] coordinates {(0,0) (2,3)};
\nextgroupplot[at=(group c2r1.north),axis y line*=right,axis x line*=top] % 2, 2nd axis
\addplot[red] coordinates {(0,3) (4,0)};
\end{groupplot}
\draw[thick,,red,shorten >=4pt,shorten <=4pt]
(group c1r1.center) node {1.} –
(group c2r1.center) node {2.};
\end{tikzpicture}
\usepackage{graphicx}
...
\begin{figure}
\includegraphics[width=0.5\linewidth]{""}
\includegraphics[width=0.5\linewidth]{""}
~
\includegraphics[width=0.5\linewidth]{""}
\includegraphics[width=0.5\linewidth]{""}
\end{figure}
\begin{tikzpicture}
\begin{axis}[name=plot1]
\addplot[blue] coordinates {(0,2) (2,0)};
\end{axis}
\begin{axis}[name=plot2,at={($(plot1.east)+(1cm,0)$)},anchor=west]
\addplot[red] coordinates {(0,0) (4,4)};
\end{axis}
\end{tikzpicture}
\usepgfplotslibrary{groupplots}
\begin{tikzpicture}
\begin{groupplot}[group style={columns=2,rows=1},]
\nextgroupplot % 1
\addplot[blue] coordinates {(0,2) (2,0)};
\nextgroupplot % 2
\addplot[red] coordinates {(0,0) (4,4)};
\end{groupplot}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[xmin=0,xmax=2,ymin=0,ymax=2,
axis y line*=left,
axis x line*=top,]
\addplot[blue] coordinates {(0,2) (2,0)};
\end{axis}
\begin{axis}[xmin=0,xmax=4,ymin=0,ymax=4,
axis y line*=right,
axis x line*=bottom,]
\addplot[red] coordinates {(0,0) (4,4)};
\end{axis}
\end{tikzpicture}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment