[pstricks] Two plots with common axis in one subfigure
Joel J. Adamson <adamsonj@email.unc.edu>
adamsonj at email.unc.edu
Tue Apr 21 18:01:20 CEST 2009
>>>>> "Michael" == Michael Sharpe <msharpe at ucsd.edu> writes:
[...]
> If you use \psframebox around each pspicture, you can see how the
> bounding boxes are aligned. (See code below.) In your example,
> they have different horizontal sizes. If you want them vertically
> aligned, make the pspicture widths the same. If you want to have
> the labels on the top picture not run into the picture below,
> decrease the top pspicture ymin value.
Thanks for getting back to me: I figured out a way to do it, but I will
definitely take your suggestions to make it even better.
Here's my current solution:
\documentclass[preprint]{aastex}
\usepackage[dvips]{geometry}
% \usepackage[round]{natbib}
\usepackage{natbib}
\usepackage{paralist}
\usepackage{mathptmx}
% \usepackage{palatino}
% \usepackage{helvet}
% line numbers:
\usepackage{lineno}
\usepackage{fancyref}
\usepackage{pstricks}
\usepackage{pstricks}
\usepackage{pst-plot}
\usepackage{pst-func}
\usepackage{pst-bar}
\begin{document}
\begin{figure}
{\sffamily
\centering\caption{(a) Two competing mating success functions of
male age. Males that mature at $\alpha_1$ mature at the same rate
as males that mature at age $\alpha_2$, producing higher mean
mating success in offspring of $\alpha_1$-males (b)
}\label{fig:bimaturism}
\begin{pspicture}(0,-4)(20,6)
% label for panel (b)
\rput{0}(0,4.5){(a)}
\label{fig:bimaturism-a}
{ \psset{yunit=2cm,xunit=1}
% panel a:
% mating success as a function of age
\rput[b]{0}(2,0){
% y axis label
\rput[b]{90}(-0.5,1){Mating Success}
% axes
\psaxes[labels = none, ticks = none](6,2)
% first line: early--fast-developing males
\psline{-}(1.5,0)(4,2)
% second line: late-and-fast-developing males
\psline[linestyle = dashed]{-}(3.5,0)(6,2)
% ages at maturity
% early:
\rput(1.5,-0.25){$\alpha_1$}
% later:
\rput(3.5,-0.25){$\alpha_2$}
}
% age distribution
\rput[t]{0}(2,-1){
% y axis label
\rput[b]{90}(-0.5,0.4){P\{age = x\}}
% age distribution:
\readpsbardata{\mydata}{data.txt}
\psbarchart[chartstyle = cluster,
barcolsep = 0,
barsep = 0,
barstyle = {gray},
showpoints = false]{\mydata}
% id like to get rid of the axis numbers
}
}
% panel b
% label for panel (b)
\rput{0}(9,4.5){(b)}
\label{fig:bimaturism-b}
\rput[bl]{0}(9,0){
% label
{\psset{yunit = 8cm}
% y-axis label
\rput{90}(-0.5,0.25){Frequency}
% x-axis label
\rput{0}(4,-0.0625){Breeding Value of Mating Success}
\psaxes[labels = none, ticks = none](5,0.5)
\psGauss[mue = 1.5, sigma = 1.5]{0}{8}
\psGauss[linestyle = dashed, mue = 0.5, sigma = 1]{0}{8}
}
}
\end{pspicture}
}
\end{figure}
\end{document}
--
Joel J. Adamson -- http://www.unc.edu/~adamsonj
University of North Carolina at Chapel Hill
CB #3280, Coker Hall
Chapel Hill, NC 27599-3280
More information about the PSTricks
mailing list