2

I'm trying to produce Taylor diagrams to compare statistically data sets. Here is the code as a first approach to such diagram.

\begin{pspicture}(-1,-1)(5.75,5.75)
   \psaxes(0,0)(4,4)
   \begin{psclip}{\pswedge(0,0){4}{0}{90}}
     \multido{\ra=1+1}{4}{%
       \pscircle[linewidth=1pt](2.6;0){\ra}%
       \psplot[algebraic]{0}{\ra}{sqrt(\ra*\ra - x*x)}}
     \multido{\rx=0.0+0.1}{10}{%
       \pstVerb{/pen \rx\space 1 div ACOS def}
       \psplot[linecolor=green]{0}{4}{x pen TAN mul}}
  \end{psclip}
  \multido{\ry=0.0+0.1}{10}{%
     \rput{! \ry\space 1 div ACOS RadtoDeg}(! \ry\space 4 mul 16 \ry\space 4 mul  
          dup mul sub sqrt){\psPrintValue{\ry\space 1 div ACOS RadtoDeg}}}
\end{pspicture}

The problem is with the second loop that draws the green lines giving:

enter image description here

Note the two green lines close to 45 degrees (should only be one). The slopes are from angles corresponding to a 1/10 division of the x axis. Surely the code can be written more easily or in a more compact way but I would appreciate to know why this code produces such anomaly or what can be wrong.

  • 1
    Welcome to TeX.SX! Please don't post code fragments. Instead, put your fragments into a complete compilable document that shows the problem. – CarLaTeX Sep 11 '17 at 21:19
2

Use a simple \psline for it:

\documentclass[pstricks]{standalone}
\usepackage{pst-plot,pst-math}
\usepackage{auto-pst-pdf}

\begin{document}

\begin{pspicture}(-1,-1)(5.75,5.75)
\psaxes(4,4)
\begin{psclip}{\pswedge(0,0){4}{0}{90}}
    \multido{\ia=1+1}{4}{%
        \pscircle[linewidth=1pt](2.6;0){\ia}%
        \psplot[algebraic]{0}{\ia}{sqrt(\ia*\ia - x*x)}}
    \multido{\rx=0.0+0.1}{10}{%
        \psline[linecolor=green](!4 \rx\space ACOS RadtoDeg PtoC)
    }
    \end{psclip}
    \multido{\ry=0.0+0.1}{10}{%
        \rput{! \ry\space ACOS RadtoDeg}(! \ry\space 4 mul 16 \ry\space 4 mul  
        dup mul sub sqrt){\psPrintValue{\ry\space ACOS RadtoDeg}}}
\end{pspicture}

\end{document}

enter image description here

An alternative solution:

\begin{pspicture}(-1,-1)(5.75,5.75)
\psaxes(4,4)
\begin{psclip}{\pswedge(0,0){4}{0}{90}}
  \multido{\ia=1+1}{4}{%
      \pscircle[linewidth=1pt](2.6;0){\ia}%
      \psarc(0,0){\ia}{0}{90}
  }
    \multido{\rx=0.0+0.1}{10}{%
        \psline[linecolor=green](!4 \rx\space ACOS RadtoDeg PtoC)
    }
\end{psclip}
\multido{\ry=0.0+0.1}{10}{%
    \rput{! \ry\space ACOS RadtoDeg}(!4.1 \ry\space ACOS RadtoDeg 1 sub PtoC){%
        \psPrintValue{\ry\space ACOS RadtoDeg}}}
\end{pspicture}
  • Thanks, I tried through \psline but the code was more complex. what PtoC stands for ?. – user1259970 Sep 12 '17 at 8:06
  • @user1259970: PtoC stands for a transforming operator that transforms Polar r Θ to Rectangular x y. Note that Θ must be in degrees. – Artificial Odorless Armpit Sep 12 '17 at 17:25
  • @user1259970: \psplot{0}{4}{\rx\space ACOS RadtoDeg tan x mul} is the same with psplot. You have a problem with your definition and angle 45 degrees. – user2478 Sep 12 '17 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.