1

Is there a way in listplotIIID to change the linecolor after say "100 points" into gray, after "500 points" back in black and so on?

\documentclass[border=0pt,10pt,dvipsnames]{standalone}
\usepackage{amsmath}
\usepackage{pstricks}
\usepackage{dashrule}
\usepackage{pst-plot}%, pst-math}
\usepackage{pst-func}
\usepackage{pst-ode}
\usepackage{pst-3dplot}
\usepackage{pst-solides3d}
\usepackage[off]{auto-pst-pdf}
\usepackage[nomessages]{fp}
\psset{algebraic,unit=2}
\usepackage[active,tightpage]{preview}
\PreviewBorder=12pt
\PreviewEnvironment{pspicture}




\makeatletter
\def\listplotIIID{\def\pst@par{}\pst@object{listplotIIID}}
\def\listplotIIID@i#1{%
\@nameuse{beginplot@\psplotstyle}%
\addto@pscode{%
   /viewpointXYZ {\pst@solides@viewpoint} def
   /Decran \pst@solides@Decran\space def % distance de l'ecran
    viewpointXYZ /ZpointVue ED /YpointVue ED /XpointVue ED
  /THETA {YpointVue XpointVue atan} bind def
  /PHI   {ZpointVue XpointVue dup mul YpointVue dup mul add sqrt atan} bind def
  /Dobs  {XpointVue dup mul YpointVue dup mul add ZpointVue dup mul add sqrt} bind def
  XpointVue YpointVue ZpointVue /viewpoint defpoint3d
    /XYZ [#1] def
  /@tabXYZ [
    0 3 XYZ length 3 sub {/i exch def
     XYZ i get
     XYZ i 1 add get
     XYZ i 2 add get
     3dto2d
     \pst@number\psunit mul exch
     \pst@number\psunit mul exch
    }  for
    ] bind def
 [ @tabXYZ aload pop
    }%
\@nameuse{endplot@\psplotstyle}}%
\makeatother


\def\r(#1){0.25*sqrt((9-#1*#1)*(#1*#1+1))}
\def\rs(#1){-(1/4)*#1*(#1^2-4)/sqrt(-(#1^2-9)*(#1^2+1))}
\def\rss(#1){-(1/4)*(#1^6-12*#1^4-27*#1^2+36)/((#1^2-9)*(#1^2+1)*sqrt(-(#1^2-9)*(#1^2+1))) }


\begin{document}
\begin{pspicture}(-2.1,-1.1)(2.5,1.2)
\psset[pst-solides3d]{viewpoint=20 5 20,Decran=20,lightsrc=viewpoint}
\defFunction[algebraic]{rot}(t,v){\r(t)*sin(v)} {t} {\r(t)*cos(v)}
\psSolid[object=surfaceparametree,base=-3 3 0 6.28,
inhue=0.01 0.11, hue=0.1 0,
function=rot,linewidth=0.5pt,grid=false,opacity=0.8,ngrid=200 70,
intersectiontype=0,       
%% Intersections with planes [a b c d] = ax + by + cz + d = 0
intersectionplan={[0 1 0 0] [0 1 0 -2.828] [0 0 1 0]},
intersectioncolor=(red) (red)  (blue),
intersectionlinewidth=1 1]

\axesIIID(1,3,1)(2,3.5,2)

\pstODEsolve[algebraic,algebraicOutputFormat]{test}{\r(x[2])*sin(x[0])
| x[2] | \r(x[2])*cos(x[0])}{0}{14}{2000}{1.57 1 2.8284 0}{ x[1] |
 -2*\rs(x[2])*x[1]*x[3]/(\r(x[2]))| x[3] |
 -\rss(x[2])*\rs(x[2])*x[3]*x[3]/(\rs(x[2])*\rs(x[2])+1)
+\rs(x[2])*\r(x[2])*x[1]*x[1]/(\rs(x[2])*\rs(x[2])+1)}

\listplotIIID[linecolor=black,linewidth=1pt]{test}

\pstODEsolve[algebraic,algebraicOutputFormat]{test}{\r(x[2])*sin(x[0]) |
 x[2] | \r(x[2])*cos(x[0])}{0}{2}{500}{1.57 -1 2.8284 0}{ x[1] |
 -2*\rs(x[2])*x[1]*x[3]/(\r(x[2]))| x[3] |
 -\rss(x[2])*\rs(x[2])*x[3]*x[3]/(\rs(x[2])*\rs(x[2])+1)
+\rs(x[2])*\r(x[2])*x[1]*x[1]/(\rs(x[2])*\rs(x[2])+1)}
\listplotIIID[linecolor=black,linewidth=1pt]{test}
\psSolid[object=point,args=0.75 2.828 0]
\end{pspicture}
\end{document}
  • yes, that is possible. Provide an example data set. – user2478 Jun 26 '15 at 10:00
  • I don't quite understand: After compiling a source file Xelatex generates a data set that I don't "see". I would like to adjust the colors - the curve is on a surface, sometimes in the front, sometimes not. I have to find the "time" when this happens. Actually many thanks for your last answer. It was extremely helpful an I can create now very nice pictures!!! – user80738 Jul 4 '15 at 12:29
  • Then provide the function in a complete example! – user2478 Jul 4 '15 at 14:21
  • Many thanks!!! Works also with linestyle=dotted.... – user80738 Jul 7 '15 at 14:21
1

the following solution defines a key valuerange=<start>-<stop>, which will be part of the next update of pst-solides3d:

\documentclass[border=0pt,10pt,dvipsnames,pstricks]{standalone}
\usepackage{amsmath}
\usepackage{dashrule}
\usepackage{pst-plot}%, pst-math}
\usepackage{pst-func}
\usepackage{pst-ode}
\usepackage{pst-3dplot}

\usepackage{pst-solides3d}
\usepackage[nomessages]{fp}
\psset{algebraic,unit=2}

\makeatletter
\define@key[psset]{}{valuerange}[1-]{\expandafter\pst@getrange#1\@nil}
\def\pst@getrange#1-#2\@nil{%
  \ifx\relax#1\relax \def\pst@startvalue{1 }\else\def\pst@startvalue{#1 }\fi%
  \ifx\relax#2\relax \def\pst@endvalue{1e32 }\else\def\pst@endvalue{#2 }\fi%
}
\psset{valuerange=1-}

\def\listplotIIID{\def\pst@par{}\pst@object{listplotIIID}}
\def\listplotIIID@i#1{%
\@nameuse{beginplot@\psplotstyle}%
\addto@pscode{%
   /viewpointXYZ {\pst@solides@viewpoint} def
   /Decran \pst@solides@Decran\space def % distance de l'ecran
    viewpointXYZ /ZpointVue ED /YpointVue ED /XpointVue ED
  /THETA {YpointVue XpointVue atan} bind def
  /PHI   {ZpointVue XpointVue dup mul YpointVue dup mul add sqrt atan} bind def
  /Dobs  {XpointVue dup mul YpointVue dup mul add ZpointVue dup mul add sqrt} bind def
  XpointVue YpointVue ZpointVue /viewpoint defpoint3d
    /XYZ [#1] def
  /@tabXYZ [
    0 3 XYZ length 3 sub {
     /i exch def
     XYZ i get
     XYZ i 1 add get
     XYZ i 2 add get
     i 3 div dup /ii ED  
       \pst@startvalue ge {
         ii \pst@endvalue le { 
         3dto2d
         \pst@number\psunit mul exch
         \pst@number\psunit mul exch
       } { pop pop pop } ifelse
     }{ pop pop pop } ifelse
    }  for
    ] bind def
 [ @tabXYZ aload pop
    }%
\@nameuse{endplot@\psplotstyle}}%
\makeatother

\def\r(#1){0.25*sqrt((9-#1*#1)*(#1*#1+1))}
\def\rs(#1){-(1/4)*#1*(#1^2-4)/sqrt(-(#1^2-9)*(#1^2+1))}
\def\rss(#1){-(1/4)*(#1^6-12*#1^4-27*#1^2+36)/((#1^2-9)*(#1^2+1)*sqrt(-(#1^2-9)*(#1^2+1))) }


\begin{document}
\begin{pspicture}(-2.1,-1.1)(2.5,1.2)
\psset[pst-solides3d]{viewpoint=20 5 20,Decran=20,lightsrc=viewpoint}
\defFunction[algebraic]{rot}(t,v){\r(t)*sin(v)} {t} {\r(t)*cos(v)}
%\psSolid[object=surfaceparametree,base=-3 3 0 6.28,inhue=0.01 0.11, hue=0.1 0,
%   function=rot,linewidth=0.5pt,grid=false,opacity=0.8,ngrid=200 70,
%   intersectiontype=0,       
%   %% Intersections with planes [a b c d] = ax + by + cz + d = 0
%   intersectionplan={[0 1 0 0] [0 1 0 -2.828] [0 0 1 0]},
%   intersectioncolor=(red) (red)  (blue),
%   intersectionlinewidth=1 1]

\axesIIID(1,3,1)(2,3.5,2)

\pstODEsolve[algebraic,algebraicOutputFormat,%saveData
  ]{test}{\r(x[2])*sin(x[0])
| x[2] | \r(x[2])*cos(x[0])}{0}{14}{2000}{1.57 1 2.8284 0}{ x[1] |
 -2*\rs(x[2])*x[1]*x[3]/(\r(x[2]))| x[3] |
 -\rss(x[2])*\rs(x[2])*x[3]*x[3]/(\rs(x[2])*\rs(x[2])+1)
+\rs(x[2])*\r(x[2])*x[1]*x[1]/(\rs(x[2])*\rs(x[2])+1)}

\listplotIIID[linewidth=1pt,linecolor=red,valuerange={-50}]{test}
\listplotIIID[linewidth=1pt,linecolor=green,valuerange={50-100}]{test}
\listplotIIID[linewidth=1pt,linecolor=blue,valuerange={100-}]{test}

\pstODEsolve[algebraic,algebraicOutputFormat]{test}{
  \r(x[2])*sin(x[0]) |
  x[2]               | 
  \r(x[2])*cos(x[0])}{0}{2}{500}{1.57 -1 2.8284 0}{ x[1] |
 -2*\rs(x[2])*x[1]*x[3]/(\r(x[2]))| x[3] |
 -\rss(x[2])*\rs(x[2])*x[3]*x[3]/(\rs(x[2])*\rs(x[2])+1)
    +\rs(x[2])*\r(x[2])*x[1]*x[1]/(\rs(x[2])*\rs(x[2])+1)}

\listplotIIID[linewidth=1pt,linecolor=cyan,valuerange={-50}]{test}
\listplotIIID[linewidth=1pt,linecolor=magenta,valuerange={50-100}]{test}
\listplotIIID[linewidth=1pt,linecolor=gray,valuerange={100-}]{test}

%\psSolid[object=point,args=0.75 2.828 0]

\end{pspicture}

\end{document}

enter image description here

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.