[pstricks] psgrid

Jean-Côme Charpentier Jean-Come.Charpentier at wanadoo.fr
Thu Nov 17 10:11:42 CET 2005


Alain Matthes wrote:
> Howdy
> 
> with this
> [...]
> or that
> [...]
> 
> i've no problem but with
> 
>         \psset{xunit =12.5 cm , yunit =1 cm}
>         \psset{gridlabels=0pt,gridwidth=0.8pt,subgridwidth=0.4pt}
>         \begin{pspicture}(0,0)(0.8,2)
>             \psgrid[subgriddiv=5]
>             \end{pspicture}
> 
> 
> The grid  is too long for me and i think that' a normal way (minimum  1 
> unit ) but how to clip the grid to the pspicture ?
> 
> i can make my personnal grid but is it possible to use psgrid ?

   Like that?

\documentclass{article}
\usepackage{pstricks}

\makeatletter
\newcommand*\psgridcliped[1][]{%
   \expandafter\get at coorpic\pic at coor\@nil
   \psclip{\psframe[linewidth=0pt, linestyle=none]
     (\@tempa,\@tempb)(\@tempc,\@tempd)}
   \psgrid[#1]
   \endpsclip
   \ignorespaces
}
\def\get at coorpic(#1,#2)(#3,#4)(#5,#6)\@nil{%
   \def\@tempa{#3}%
   \def\@tempb{#4}%
   \def\@tempc{#5}%
   \def\@tempd{#6}%
}
\makeatother
\begin{document}
\begin{pspicture}(0.8,1.9)(5.3,5.8)
   \psgridcliped[gridlabels=0pt]
\end{pspicture}

\vspace{1cm}
\begin{pspicture}(0.8,1.9)(5.3,5.8)
   \psgrid
\end{pspicture}

\end{document}

   Jean-Côme Charpentier




More information about the PSTricks mailing list