Saturday, February 4, 2012

More options on pstricks plotting (2)

When a Logarithmic scale graph is plot, "x(y)logBase=num|empty", and "logLines=none|x|y|all" are useful. The first one controls the logBse of corresponding axes. The later one controls the log grid line.

Let us plot a logarithmic scale graph to shown how these options are used.

\documentclass{article}
\usepackage{pstricks}
\usepackage{pstricks-add}
\usepackage{pst-plot}
\begin{document}
  \begin{pspicture}(0,0)(6,5)
  \psaxes[axesstyle=frame,ylogBase=10,
    subticks=5,logLines=y](0,0)(6,5)
  \psplot[linecolor=red]{0}{5}{x}
  \psplot[linecolor=blue,linestyle=dotted,
    linewidth=1.5pt,dotsep=1pt]
    {0}{6}{0.5 x mul}
  \psplot[linecolor=green,linestyle=dashed]
    {1}{6}{x log 4 mul}
  \rput(3.5,4.25){\color{red}$y=10^{x}$}
  \rput(3,2.25){\color{green}$y=x^{4}$}
  \rput(3.5,1.25){\color{blue}$y=10^{x/2}$}
  \rput(3,-0.75){$x$}
  \rput(-1,2.5){$y$}
  \end{pspicture}
\end{document}

Fig.1 Plotting Logarithmic scale graph using Pstricks.

Options "nStep, nStart, nEnd, xStep, XStart, xEnd, yStart, yEnd" controls the plot range.

By default the plot macros expect x|y data records, but when data files contains more than one y value, like:
x y1 y2 ... yMax
x y1 y2 ... yMax
...
one can select the column to be plotted using "plotNo" and "PlotNoMax". "plotNo=num" tells pst-plot to plot the num-th y-column. "plotNoMax" tells pst-plot how many y-column are present.

Files: tex ps pdf

No comments:

Post a Comment

Creative Commons License
Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.