zauguin / luapstricks

8 stars 0 forks source link

\pscuston and \code #47

Closed hvoss49 closed 3 years ago

hvoss49 commented 3 years ago

Only the first value (6.8) is printed on the graph

\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{uncompress}
\documentclass[border=5mm]{standalone}
\usepackage{pst-plot}

\makeatletter
\def\plotValues#1{%
  \pscustom{\code{
    /xOffset 5 def   /yOffset -2 def
    /Feld [ #1 ] def /cnt 0 def
    /Times-Roman findfont 11 scalefont setfont
    Feld length 2 div cvi {
      Feld cnt get /x ED Feld cnt 1 add get /y ED
      x \pst@number\psxunit mul xOffset add
      y \pst@number\psyunit mul yOffset add
      moveto x 10 string cvs show
      /cnt cnt 2 add def
    } repeat }}}
\makeatother
\def\dataV{6.8 -1 5.9 -2 5.4 -3 5.7 -4 6.2 -5}
\begin{document}
\begin{pspicture}(3.5,0.5)(8,-5.5)
  \psaxes[Ox=4]{->}(4,0)(8,-5)
  \listplot[plotstyle=curve, showpoints]{\dataV}
  \plotValues{\dataV}
\end{pspicture}
\end{document}
Bildschirmfoto 2021-09-03 um 09 24 55

Expected output is:

Bildschirmfoto 2021-09-03 um 09 27 14
zauguin commented 3 years ago

Fixed (restoring the current matrix after printing text was broken)