[pstricks] multipanel pstricks figures from enterline

Herbert Voss LaTeX at zedat.fu-berlin.de
Sat Sep 9 16:12:35 CEST 2006



Andrew Enterline wrote:

> i'm a pstricks user interested creating multipanel displays (i.e., 4 or 
> 6 separate line plots arranged side-by-side on a single page).  although 
> i fooled with minipage some, i haven't been able to achieve a 
> side-by-side arrangement.  below, i'm pasting the code that i've used to 
> create two separate line plots (a postscript of the compiled plots is 
> attached).  does anyone know how to achieve the multipanel format? i'd 
> very much appreciate help with my own code or an example that will 
> illustrate the fix.

you can use the subfig package or the minipage environment
together with the \resizebox command.

Herbert

\documentclass[12pt]{article}
\usepackage{pst-plot}
\usepackage{caption,subfig,graphicx}
\captionsetup[figure]{position=top}

\def\data{1   0
2   0 3   -0.8 4   -0.88190155 5   -0.91371914 6   -0.9257962 7
-0.93899541 8   -0.93357528 9   -0.93287236 10  -0.94071641 11
-0.93627821 12  -0.9264599 13  -0.90910625 14  -0.89491569 15
-0.91643641 16  -0.93481277 17  -0.94319856 18  -0.95191231 19
-0.95818646 20  -0.96288146 21  -0.9665351 22  -0.96946525 23
-0.97109424 24  -0.97003626 25  -0.96780662 26  -0.96415888 27
-0.95867213 28  -0.95067902 29  -0.93915236 30  -0.92253831 31
-0.89853476 32  -0.86385869 33  -0.81417129 34  -0.76860219 35
-0.76218947 36  -0.81789845 }
\def\datab{1   0
2   0 3   0.0175439 4   0.0166594 5   0.0334057 6   0.0318283 7
0.0545219 8   0.1200221 9   0.1571008 10  0.1801961 11  0.1927926 12
0.2020815 13  0.1965785 14  0.2068912 15  0.2216921 16  0.2371183 17
0.2360609 18  0.23064 19  0.2200617 20  0.204856 21  0.1877612 22
0.1831834 23  0.2373815 24  0.232248 25  0.2222152 26  0.2077539 27
0.1974546 28  0.1994574 29  0.3512563 30  0.3525538 31  0.3587744 32
0.3892896 33  0.4516209 34  0.4967693 35  0.5139254 36  0.5094636}
\def\datc{1 0
2 0 3   -0.8 4   -0.77636229 5   -0.72302494 6   -0.85781332 7
-0.82451556 8   -0.74024564 9   -0.57376906 10  -0.33120184 11
-0.12425333 12  -0.41499973 13  -0.82190447 14  -0.88977912 15
-0.91751982 16  -0.91601934 17  -0.93225145 18  -0.92735786 19
-0.93612978 20  -0.94590167 21  -0.94147545 22  -0.94045111 23
-0.93599441 24  -0.92613582 25  -0.90871322 26  -0.87977818 27
-0.83281575 28  -0.7584458 29  -0.64696293 30  -0.59184783 31
-0.84282195 32  -0.90037193 33  -0.90888729 34  -0.90568924 35
-0.8945038 36  -0.87371292}

\def\datad{1
2   0 3   0 4   0 5   0 6   0 7   0 8   0 9   0 10  0 11  0.0037357
12  0.0100133 13  0.0078156 14  0.016627 15  0.0210046 16  0.0178376
17  0.0192925 18  0.0236826 19  0.0420799 20  0.0378221 21 0.0305156
22  0.0220562 23  0.01683 24  0.0387297 25  0.0357437 26 0.0351332
27  0.0326168 28  0.037429 29  0.0352412 30  0.0312296 31 0.028663
32  0.0334667 33  0.0317155 34  0.0284753 35  0.0242096 36
0.0192314}

\begin{document}

\begin{figure}[!htb]
\subfloat[United States--Russia Dyad,\newline 
1965--2000.\label{usarus_dyad}]{%
\resizebox{0.475\linewidth}{!}{%
\psset{xunit=.27, yunit=4.5}% to get 10cm x 10cm with the data values
\begin{pspicture}(-7,-1)(36,1)
   \psaxes[tickstyle=bottom,Ox=1965,Dx=5,Dy=.25](0,0)(0,-1)(36,1)
   \listplot[linecolor=red,linewidth=1pt]{\data}%
   \listplot[linecolor=blue,linewidth=1pt]{\datab}%
   \rput{90}(-7,-0.5){Conflict}
   \rput{90}(-7,0.5){Cooperation}
\end{pspicture}
}}\hfill%
\subfloat[United States--North Korea Dyad,\newline 
1965--2000.\label{usarnkor_dyad}]{%
\resizebox{0.475\linewidth}{!}{%
\psset{xunit=.27, yunit=4.5}% to get 10cm x 10cm with the data values
\begin{pspicture}(-7,-1)(36,1)
   \psaxes[tickstyle=bottom,Ox=1965,Dx=5,Dy=.25](0,0)(0,-1)(36,1)
   \listplot[linecolor=red,linewidth=1pt]{\datc}%
   \listplot[linecolor=blue,linewidth=1pt]{\datad}%
   \rput{90}(-7,-0.5){Conflict}
   \rput{90}(-7,0.5){Cooperation}
\end{pspicture}
}}
\end{figure}

\newpage

\begin{figure}[!htb]
\captionsetup{font=small}
\begin{minipage}{0.475\linewidth}
\caption{United States--Russia Dyad,\newline 1965--2000.}\label{usarus_dyad}
\resizebox{\linewidth}{!}{%
\psset{xunit=.27, yunit=4.5}% to get 10cm x 10cm with the data values
\begin{pspicture}(-7,-1)(36,1)
   \psaxes[tickstyle=bottom,Ox=1965,Dx=5,Dy=.25](0,0)(0,-1)(36,1)
   \listplot[linecolor=red,linewidth=1pt]{\data}%
   \listplot[linecolor=blue,linewidth=1pt]{\datab}%
   \rput{90}(-7,-0.5){Conflict}
   \rput{90}(-7,0.5){Cooperation}
\end{pspicture}
}
\end{minipage}\hfill%
\captionsetup{singlelinecheck=off}
\begin{minipage}{0.475\linewidth}
\caption{\rlap{United States--North Korea Dyad},
    \newline 1965--2000.}\label{usarnkor_dyad}
\resizebox{\linewidth}{!}{%
\psset{xunit=.27, yunit=4.5}% to get 10cm x 10cm with the data values
\begin{pspicture}(-7,-1)(36,1)
   \psaxes[tickstyle=bottom,Ox=1965,Dx=5,Dy=.25](0,0)(0,-1)(36,1)
   \listplot[linecolor=red,linewidth=1pt]{\datc}%
   \listplot[linecolor=blue,linewidth=1pt]{\datad}%
   \rput{90}(-7,-0.5){Conflict}
   \rput{90}(-7,0.5){Cooperation}
\end{pspicture}
}
\end{minipage}
\end{figure}

\end{document}





More information about the PSTricks mailing list