[pstricks] Operating individual parts of data / LowLevel syntax

Herbert Voss Herbert.Voss at FU-Berlin.DE
Fri Dec 11 09:07:15 CET 2009


Am 11.12.2009 00:24, schrieb Jorge Nto:

> Now I am almost ready with my application. A data set of three columns, from
> which the two first store coordinates and the third one a radius, should be
> plotted as circles.
> The problem is that as I use the command \pscircle, the radius must be
> scaled down.  So in the following code snipset:
> 
> \def\psLabelPlot{\pst at object{psLabelPlot}}
> \def\psLabelPlot at i#1{\begin at SpecialObj\expandafter\psLabelPlot at ii#1}
> \def\psLabelPlot at ii #1{\psLabelPlot at iii#1}
> \def\psLabelPlot at iii#1 #2 #3 #4 #5 #6 {%
>     \pscircle(#2,#4){0.5}%
> 
> 
>     \@ifnextchar D{\psLabelPlot at iii}{\end at SpecialObj}%
> }
> 
> I would like to replace in the line \pscircle(#2,#4){0.5}% I would like to
> use the parameter #6 (but scaled) instead of the 0.5
> I tried RPN syntax, but of course it did not work (\pscircle(#2,#4){#6 50
> div}) the multiplication sign doesnt work either (\pscircle(#2,#4){#6*0.02})


\listfiles
\documentclass[12pt]{article}
\usepackage{filecontents}
\begin{filecontents}{circle.data}
0, 1, 0.5
1, 1.5, 2.345
2, 3, 0.2
6, 2.2, 1
10, 2.34,1.234
\end{filecontents}

\usepackage{pstricks-add}
\pagestyle{empty}
\parindent=0pt

\makeatletter
\def\psCirclePlot{\pst at object{psCirclePlot}}
\def\psCirclePlot at i#1{\begin at SpecialObj\expandafter\psCirclePlot at ii#1}
\def\psCirclePlot at ii #1{\psCirclePlot at iii#1}
\def\psCirclePlot at iii#1 #2 #3 #4 #5 #6 {%
  \pscircle(#2,#4){! #6 0.5 mul}%
    \@ifnextchar D{\psCirclePlot at iii}{\end at SpecialObj}}
\makeatother
\begin{document}

\begin{psgraph}(0,0)(10,5){.6\linewidth}{5cm}
  \readdata{\CircleData}{circle.data}
  \psCirclePlot[linestyle=dashed,linecolor=red]{\CircleData}
\end{psgraph}

\end{document}

Herbert


More information about the PSTricks mailing list