[pstricks] pstricks plot in a floating figure is drawn above text

Herbert Voss Herbert.Voss at FU-Berlin.DE
Thu Jul 22 21:06:30 CEST 2010


Am 22.07.2010 20:50, schrieb George:
> I tried to include a plot in my document using:
> 
> %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> \begin {figure}[ht]
> \begin {center}
> %\includegraphics[width=\figurewidth]{dram_price.eps}
> \psset{xunit=.5cm,yunit=4.5cm}
>  \savedata{\mydata}[
>  {{0, 0}, {1., 0.946083}, {2., 1.60541}, {3., 1.84865}, {4.,
> .7582},
>  {5., 1.54993}, {6., 1.42469}, {7., 1.4546}, {8., 1.57419},
>  {9., 1.66504}, {10., 1.65835}, {11., 1.57831}, {12., 1.50497},
>  {13., 1.49936}, {14., 1.55621}, {15., 1.61819}, {16., 1.6313},
>  {17., 1.59014}, {18., 1.53661}, {19., 1.51863}, {20., 1.54824}}]
>  \dataplot[plotstyle=curve,showpoints=true,
>  dotstyle=triangle]{\mydata}
>  \psline{<->}(0,2)(0,0)(20,0)
> \end {center}
> \caption {Prices of different capacity DRAM chips in 1977 dollars
> 			\cite{patt_and_henn_quantitative}}
> \label {dram_price}
> \end {figure}
> %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> But what I get is this:
> 
> http://i31.tinypic.com/5dm5io.png
> 
> Isn't it possible to have pstricks as a floating figure?

sure! But you have to reserve some space for the image
otherwise it is drawn overt he text.

\documentclass[a4paper,12pt,ngerman,twoside]{article}
\usepackage{pst-plot}
\begin{document}

\begin{figure}[!htb]
\centering
%\includegraphics[width=\figurewidth]{dram_price.eps}
\psset{xunit=.5cm,yunit=4.5cm}
\begin{pspicture}(20,2)% A box of 10cm x 9cm
 \savedata{\mydata}[
 {{0, 0}, {1., 0.946083}, {2., 1.60541}, {3., 1.84865}, {4.,
.7582},
 {5., 1.54993}, {6., 1.42469}, {7., 1.4546}, {8., 1.57419},
 {9., 1.66504}, {10., 1.65835}, {11., 1.57831}, {12., 1.50497},
 {13., 1.49936}, {14., 1.55621}, {15., 1.61819}, {16., 1.6313},
 {17., 1.59014}, {18., 1.53661}, {19., 1.51863}, {20., 1.54824}}]
 \dataplot[plotstyle=curve,showpoints=true,
 dotstyle=triangle]{\mydata}
 \psline{<->}(0,2)(0,0)(20,0)
\end{pspicture}
\caption {Prices of different capacity DRAM chips in 1977 dollars}\label
{dram_price}
\end {figure}

\blinddocument

\end{document}

Herbert


More information about the PSTricks mailing list