Tux

...making Linux just a little more fun!

Talkback:133/luana.html

[ In reference to "Plotting the spirograph equations with 'gnuplot'" in LG#133 ]

Sonja Schmid [schmid.sonja at gmx.ch]


Thu, 30 Jul 2009 09:48:13 +0200

Dear Víctor Luaña,

I just saw how you drew these labels of the angles in Fig. 1 on page http://linuxgazette.net/133/luana.html . Could you tell me what gnuplot code you use to do so??

Thanks very much in advance!

Sonja


Top    Back


Victor Lua~na Cabal [victor at carbono.quimica.uniovi.es]


Thu, 30 Jul 2009 15:21:24 +0200

> From: Ben Okopnik <ben@linuxgazette.net>
> ----- Forwarded message from Sonja Schmid <schmid.sonja@gmx.ch> -----
>
> From: Sonja Schmid <schmid.sonja@gmx.ch>
> To: tag@lists.linuxgazette.net
> Date: Thu, 30 Jul 2009 09:48:13 +0200
> Subject: [TAG] tkb: Talkback:133/luana.html
> Reply-To: The Answer Gang <tag@lists.linuxgazette.net>
> Sender: tag-bounces@lists.linuxgazette.net
>
> Dear Víctor Luaña,
>
> I just saw how you drew these labels of the angles in Fig. 1 on page 
> http://linuxgazette.net/133/luana.html .
> Could you tell me what gnuplot code you use to do so??
>
> Thanks very much in advance!

Sonja,

Where all the rest of figures in the article have been done with gnuplot, Fig 1 was produced with pstricks, a drawing package for the TeX/LaTeX typesetting software. Just in case you keep interested I reproduce below the code used. Noticed that it has not been optimized in any way: just some dirt and quick code to produce the illustration. Pstricks is an impressive tool for producing technical drawings but requires a careful planning. Check <http://tug.org/PSTricks/main.cgi/> for an extensive set of examples and documentation.

Let me know if I can be of further help.

Best regards, Víctor Luaña

Image code follows. Save the file as spiro1.tex and compile it with latex with the pstricks package installed:

\documentclass[a4paper,12pt]{article}
\usepackage[dvipsnames]{pstricks}
%\usepackage{xcolor}
\usepackage{pst-plot}
\usepackage{pst-node}
\parindent=0pt
\makeatletter
 
\begin{document}
\pagestyle{empty}
 
%\large
\psset{unit=1cm}
\definecolor{gr00}{gray}{0.0}
\definecolor{gr01}{gray}{0.1}
\definecolor{gr02}{gray}{0.2}
\definecolor{gr03}{gray}{0.3}
\definecolor{gr04}{gray}{0.4}
\definecolor{gr05}{gray}{0.5}
\definecolor{gr06}{gray}{0.6}
\definecolor{gr07}{gray}{0.7}
\definecolor{gr08}{gray}{0.8}
\definecolor{gr09}{gray}{0.9}
\begin{pspicture}(-5,-5)(5,5)
   \begingroup
      %\psgrid[gridcolor=Peach%
      %       ,subgridcolor=Apricot%
      %       ,gridlabelcolor=Red%
      %       ,subgriddiv=1%
      %       ,griddots=10%
      %       ,gridlabels=9pt](-5,-5)(5,5)
      \psset{arrowsize=4pt 4, arrowlength=2, arrowinset=0.4}
      \psset{dotscale=1.3}
      \SpecialCoor
      \begingroup
         \psset{linecolor=gr09}
         \parametricplot[plotstyle=line,plotpoints=201]{0}{720}%
                {t cos 3.5 mul t 3.5 mul cos 1.5 mul add %
                 t sin 3.5 mul t 3.5 mul sin 1.5 mul sub}
      \endgroup
      \psdots(0,0)
      \pscircle(0,0){4.5}
      \begingroup
         \psset{linecolor=gr00}
         \psline[linestyle=dotted]{-}(0,0)(3.5,0)
         \pscircle(3.5,0){1}
         \psline[linewidth=2pt]{-}(3.5,0)(5,0)
         \psdots(4.5,0)(3.5,0)(5,0)
      \endgroup
      %%%\begingroup
      %%%   \psset{linecolor=gr06}
      %%%   \psline[linestyle=dotted]{-}(0,0)(3.5;10)
      %%%   \pscircle(3.5;10){1}
      %%%   \pswedge[fillstyle=solid,fillcolor=gr03](0,0){0.6}{0}{10}
      %%%   \psline[linewidth=2pt]{-}(3.5;10)%
      %%%          (!10 cos 3.5 mul 10 3.5 mul cos 1.5 mul add %
      %%%            10 sin 3.5 mul 10 3.5 mul sin 1.5 mul sub)
      %%%\endgroup
      \begingroup
         \psset{linecolor=gr00}
         %\psline[linestyle=dotted]{-}(0,0)(3.5;49)
         \psline[linestyle=dotted]{-}(0,0)(5.5;49)
         \pnode(3.5;49){Oprime}
         \pnode(!49 cos 3.5 mul 49 3.5 mul cos 1.5 mul add %
                 49 sin 3.5 mul 49 3.5 mul sin 1.5 mul sub){P}
         \pnode(4.5;0){Q}
         \pnode(4.5;49){S}
         \pnode(!49 cos 3.5 mul 49 3.5 mul cos 1.0 mul add %
                 49 sin 3.5 mul 49 3.5 mul sin 1.0 mul sub){T}
         %\pnode(!49 cos 3.5 mul 49 3.5 mul cos 0.5 mul add %
         %        49 sin 3.5 mul 49 3.5 mul sin 0.5 mul sub){W}
         \psdots(Oprime)(P)(Q)(S)(T)
         \uput[215](0,0){O}
         \uput[115](Oprime){O$^\prime$}
         \uput[135](P){P}
         \uput[50](Q){Q}
         \uput[90](S){S}
         \uput[115](T){T}
         \pscircle(Oprime){1}
         \pswedge[fillstyle=solid,fillcolor=gr03](0,0){0.6}{0}{49}
         \uput{17.5pt}[25](O){$\varphi$}
         \psline[linestyle=dotted]{-}(Oprime)%
                (!49 cos 3.5 mul 2.0 add 49 sin 3.5 mul)
         \pswedge[fillstyle=solid,fillcolor=gr03](Oprime){0.6}{0}{49}
         \uput{17.5pt}[25](Oprime){$\varphi$}
         \pswedge[fillstyle=solid,fillcolor=gr05](Oprime){0.4}{-171.5}{0}
         \uput{14pt}[-85.75](Oprime){$\beta$}
         \psline[linewidth=2pt]{-}(Oprime)(P)
         \parametricplot[plotstyle=line,plotpoints=51]{0}{49}%
                {t cos 3.5 mul t 3.5 mul cos 1.5 mul add %
                 t sin 3.5 mul t 3.5 mul sin 1.5 mul sub}
      \endgroup
      \begingroup
         \psset{arrowsize=3pt 3, arrowlength=1.2, arrowinset=0.3}
         \psset{linecolor=Blue}
         \psline{|<->|}(0,-1.2)(4.5,-1.2)
         \uput[-90](2.25,-1.2){$R$}
         \psline{|<->|}(3.5,-2.2)(2.5,-2.2)
         \uput[-90](3.0,-2.2){$r$}
         \psline{|<->|}(3.5,-2.2)(5.0,-2.2)
         \uput[-90](4.25,-2.2){$p$}
      \endgroup
   \endgroup
\end{pspicture}
\normalsize
 
\end{document}


Top    Back