[pstricks] Placing labels at arbitrary positions

hjsalchow at aol.com hjsalchow at aol.com
Mon Oct 16 13:04:13 CEST 2006

Dear Matthias,

tho the easiest (may be not the most elegant) way to work with a non-TeX
data files is to change the form of the data a bit; say form
"text(x,y,label)" as you stated to "\mymacro text(x,y,label)".

Example: Say you have a data file that puts the words "first label ..."
and "second label ..." at coordinates (1,2) and (2,1). After the above
stated conversions your data.tex file may look like this

%%%begin of data.tex
\mymacro text(1,2,first label ...)
\mymacro text(2,1,second label ...)
%%% end of data.tex

This following TeX reads you data.tex file and places the labels:

%%%begin of mother.tex
\def\mymacro text(#1,#2,#3){\rput[bl](#1,#2){#3}}
\input data
%%% end of mother.tex

Just to be complete recall that "..." should be converted to "$\ldots$".

To learn more about
- \def 's read Donald Knuth (1986) The TeXbook, ISBN 0-201-13447-0,
chapter 20 and
- \rput read  Herbert Voß'  (2005), PSTricks, ISBN 3-86541-073-1,
chapter 9 and

Best regards
Hans-Juergen Salchow

sofa-surfer at web.de schrieb:
> Hi,
> I'm currently doing my first experiences with pstricks. So far, I used 
> R to generate my graphs. I found, that the psgraph-environment from the 
> pstricks-add package is well suited for my problems. Thus, by writing 
> my R-generated values into a file and using \readdata, I end up with 
> nice plots. I'm now wondering if there is a macro similar to one which 
> I was using heavily with R. There, the function is called "text" and 
> has the following functionality:
> text(x,y,labels,...)
> -> It takes a vector of x and y coordinates  and writes the 
> corresponding values which are stored in the labels vector at those  
> positions, one label at each (x,y)-pair.
> Maybe someone can give me a hint? (The labels should be read from a 
> file.)
> Thanks,
> Matthias
> _______________________________________________
> pstricks mailing list
> pstricks at tug.org
> http://tug.org/mailman/listinfo/pstricks

More information about the PSTricks mailing list