[pstricks] Improving Code

Herbert Voss Herbert.Voss at FU-Berlin.DE
Mon Oct 26 18:49:44 CET 2009


Rich Shepard schrieb:

>   The first template is for the axes. The following code produces the
> results I want, but I'm sure there is a more efficient way of writing the
> code to get these results. My particular concern is that I've not specified
> units or lengths optimally. I would like you more experienced PSTricks
> writers to suggest more efficient ways for me to generate a set of axes
> that
> have the proportions, ticks, and labels as does the following code.
> 
> \documentclass[letterpaper,10pt]{article}
> \usepackage{pstricks,pst-plot}
> 
> \begin{document}
>   \psset{xunit=0.1cm,yunit=5cm}
>   \begin{pspicture}(-2,-2)(100,1)
>     \psaxes[axesstyle=axes,Dx=10,Dy=0.25,tickstyle=bottom]{-}(100,1)
>     \rput(50,-0.2){Domain}
>     \rput{90}(-14,0.55){Membership Grade ($\mu$)}
>   \end{pspicture}
> 
> \end{document}

this is okay. The only advantage of using \psgraph is
the fact that you do not need the units.

\documentclass[letterpaper,10pt]{article}
\usepackage{pstricks-add}

\begin{document}
\psset{axesstyle=axes,Dx=10,Dy=0.25,tickstyle=bottom,
    llx=-1.5cm,lly=-1.1cm,urx=1mm,ury=1mm,
    xAxisLabel=Domain,xAxisLabelPos={c,-0.2},
    yAxisLabel={Membership Grade ($\mu$)},yAxisLabelPos={-14,c}}
\psframebox{% only for Demo
\begin{psgraph}(0,0)(100,1){10cm}{5cm}
\psline(100,1)
\psline(100,0)(0,1)
\end{psgraph}}

\end{document}


Herbert


More information about the PSTricks mailing list