[pstricks] Opening a data file with postscript
Herbert Voss
Herbert.Voss at fu-berlin.de
Mon Sep 23 15:38:11 CEST 2024
Am 22.09.24 um 23:15 schrieb Poul Riis:
> Even if it triggers an error message from ps2pdf the following program
> produces a perfect .ps file - and I can save it as a .pdf file with
> the ghostviewer!
> Do you think it is possible to make ps2pdf work with some options?
> It seems impossible to reuse the matrix in another \pstverb or any
> other pstricks command. Do you know why? And is there a workaround?
> Is there a way to calculate xscale and yscale from the psgraph
> definitions?
> Well, I know this is not very important because I can just use
> datatool instead but I'm crazy enough.... - and I would like to
> understand the reasons for the problems - obviously it is not true
> when it is said that postscript does not allow access to external files...
\pstverb -> outside pspicture
\pstVerb -> inside pspicture
\documentclass[a4paper,14pt]{article}
\usepackage[x11names]{xcolor}
\usepackage{pstricks-add}
\begin{document}
~
\makeatletter
\begin{psgraph}[axesstyle=frame,ticksize=0 -3pt,subticks=5,
Dx=5,Dy=200,yAxisLabel={Velocity (km/s)},
xAxisLabel={Distance (Mpc)},llx=-1cm,xAxisLabelPos={6cm,-1 cm},
yAxisLabelPos={-1.5cm,3cm}](0,0)(30,1200){12cm}{8cm}%
\pstVerb{(/tmp/hubblepsarrays.txt) run
currentpoint translate
/ndat 18 def
/xscale {\pst at number\psxunit mul} def
/yscale {\pst at number\psyunit mul} def
30 xscale 1200 yscale 5 0 360 arc 1 0 0 setrgbcolor fill stroke
0 1 0.5 setrgbcolor
0 1 ndat {
/ii exch def
xhubble ii get xscale
yhubble ii get yscale
2 0 360 arc fill stroke} for
1 0 0 setrgbcolor
0 1 ndat {
/ii exch def
xstel ii get xscale
ystel ii get yscale
2 0 360 arc fill stroke} for
0 0 1 setrgbcolor
[3 3] 0 setdash
0 1 ndat {
/ii exch def
xhubble ii get xscale
yhubble ii get yscale
moveto
xstel ii get xscale
ystel ii get yscale
lineto stroke
} for
%showpage
}
\psline(0,0)(0,-400)(30,-400)(30,0)
%\psline(!0 0)(!xhubble 5 get yhubble 5 get)
\end{psgraph}
\end{document}
Herbert
More information about the PSTricks
mailing list.