## Sunday, February 26, 2012

### Pstricks defined plotting suitable environment --- psgraph

Except allocating spaces for the pstricks elements just as what pspicture does, this new environment also does the scaling and draws the axes. It means that the axes drawing and transformation from physical coordinate to mathematical coordinate will be done automatically. The syntax is:

\begin{psgraph}[options]{arrowstyle}%
(xorigin,yorigin)(xmin,ymin)(xmax,ymax){width}{height}
...
\end{psgraph}


where the options are similar to those of "\psaxes" macro. "arrowstyle" controls the arrwostyle of axes. "(xorigin,yorigin)", "(xmin,ymin)" and "(xmax,ymax)" define the coordinate system. "width" and "height" determine the physical width and height of the graph. Now we show the advantage of this new environment by the following example.

\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-plot}
\begin{document}
\psset{
axesstyle=frame,ysubticks=2,
xsubticks=4,subticksize=0.5,
subtickcolor=black,xAxisLabel=Time(s),
xAxisLabelPos={c,-1cm},
yAxisLabel=Voltage(mV),
yAxisLabelPos={-1cm,c}
}
\begin{psgraph}[Dx=2,Dy=10,Ox=-2,Oy=-10]
{->}(-2,-10)(6,75){8cm}{5cm}
\psplot[linecolor=red]{-2}{6}{2 x exp}
\psplot[plotpoints=500,linecolor=blue]
{-2}{6}{2 x exp 500 x mul sin add}
\rput(-1.5,65){\psline[linecolor=red]
(0,0)(0.75cm,0)}
\rput[l](-0.5,65){Original Theory}
\rput(-1.5,55){\psline[linecolor=blue]
(0,0)(0.75cm,0)}
\rput[l](-0.5,55){Improved Theory}
\end{psgraph}
\end{document}


 Fig.1 Pstricks defined plotting suitable environment --- psgraph

Isn't it more convinient than pspicture?