11

I'm currently trying to create the following image with TikZ:

enter image description here

I currently have:

enter image description here

But the orange part is missing. How can I get this?

(By the way: This looks much better as PDF ... there seems to be a problem in my toolchain for PNG-creation. But that's not part of this question.)

That's the source:

\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{amsmath,amssymb}% math symbols / fonts
\usepackage{pgfplots}
\usetikzlibrary{decorations.markings}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}
\draw[->, thick] (7,5) -- (7, 2) node [midway, right] {$p$};
\node at (1,5.5) {$\mathbb{R}$} ;
\node at (6.4,0.7) {$\color{blue} S^1$};
\node at (4.9,1.1){$x$};
\begin{axis}[
 view={-30}{-45},
 axis lines=middle,
 zmax=60,
 height=8cm,
 xtick=\empty,
 ytick=\empty,
 ztick=\empty,
 enlarge y limits=true,
 enlarge x limits=true,
]

\addplot3+[->,ytick=\empty,yticklabel=\empty,
  mark=none,
  thick,
  black,
  domain=0:14.8*pi,
  samples=400,
  samples y=0,
]
({sin(deg(x))},{cos(deg(x)},{x+15});
\addplot3+[ytick=\empty,yticklabel=\empty,
  mark=none,
  thick,
  dotted,
  black,
  domain=-1:0,
  samples=100,
  samples y=0,
]
({sin(deg(x))},{cos(deg(x)},{x+15});

\addplot3+[,ytick=\empty,yticklabel=\empty,
  mark=none,
  thick,
  blue,
  domain=0:14.7*pi,
  samples=400,
  samples y=0,
]
({sin(deg(x))},{cos(deg(x)},{0});

%%%%%%%%%%%%% Point
\addplot3+[
  mark options={color=black},
  mark=*
] 
coordinates {({sin(deg(45)},{cos(deg(45))},0)};
%%%%%%%%%%%%%

\end{axis}
\end{tikzpicture}
\end{document}

2 Answers 2

14

This is another case where Asymptote is so much easier:

enter image description here

Here's the code:

\documentclass{standalone}
\usepackage{asymptote}

\begin{document}

\begin{asy}[width=10cm,height=10cm]
import graph3;

usepackage("amsfonts");

size3(200);

currentprojection=orthographic(4,6,3);

// parametrization
real x(real t) {return cos(2pi*t);}
real y(real t) {return sin(2pi*t);}
real z(real t) {return 0.5*t;}
real z0(real t) {return 0;}

scale(true);

// some parameters
real delta = 0.01;
real phix = 0.1;
real phim = 6.7;

// spiral
path3 spiral1 = graph(x,y,z,0.9,1,operator ..);
draw(spiral1,dotted);
path3 spiral2 = graph(x,y,z,1,phim,operator ..);
draw(spiral2,Arrow3);

// blue circle
draw(unitcircle3, blue);

// orange segments
pen sp = orange+1;

draw(graph(x,y,z0,phix-delta,phix+delta,operator ..),sp);
for(real i=1; i<phim; ++i) {
  draw(graph(x,y,z,i+phix-delta,i+phix+delta,operator ..),sp);
}

// the dot x
triple px = (x(phix),y(phix),0);
dot(px);
label("$x$",px,S);

// axes and labels
xaxis3("",red,Arrow3);
yaxis3("",red,Arrow3);
zaxis3("",red,Arrow3);

label("$\mathbb{R}$",(1,-1,4));

draw((-1,1,4)--(-1,1,1),Arrow3);
label("$p$",(-1,1,2.5),E);

label("$S^1$",(-1,1,0),W,blue);
\end{asy}

\end{document}
6
  • Could you please give some explanations? I've never used asymptote before and I don't understand the following points: 1. What does the size3(200); command do? Removing it seems to have no effect. 2. What does operator .. do? Removing it seems to have no effect. 3. How do I give the axes arrow heads? 4. How do I get the dotted spiral at the end? Commented Dec 13, 2013 at 12:39
  • @moose The size3() is only needed for standalone .asy files; when embedded into latex you can omit it (the asy environment adds it). The operator .. connects points by splines. If they are close enough you don't see the difference to straight lines --. For the other questions see the updated answer.
    – Alex
    Commented Dec 13, 2013 at 13:36
  • Wow, this looks awesome! Thank you very much! I definitely have to learn how to work with asymptote by myself. Commented Dec 13, 2013 at 13:54
  • @moose Yes, Asymptote is fun. I'm learning it solving problems from this site. How do you like the billiard tex.stackexchange.com/questions/149741/… ?
    – Alex
    Commented Dec 13, 2013 at 14:16
  • I hate to sound like I'm advertising, but you might be able to improve this answer using my proposed underpath module: sourceforge.net/p/asymptote/patches/22 Commented Dec 14, 2013 at 4:06
7

Well easiness I disagree :P Two minutes of tweaking with QTikZ (by no means a generic answer)

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[scale=2,mydeco/.style={decoration={
    markings,
    mark=between positions 0.115 and 1 step 0.2 with { 
        \node at (-2.8mm,0) {(};
        \node at (2.8mm,0) {)};
        }
    }
}]
\begin{axis}[hide axis,height=7cm,width=4cm,view={50}{7},samples y=0,no marks]
\addplot3+[-latex,samples=200,domain=0:10*pi,
    postaction={-,dashed,draw,orange,thick,dash pattern=on 6mm off 3.275cm,dash phase=19.5mm,
    postaction={mydeco,decorate}}
    ] ({sin(deg(-x))},{cos(deg(x))},x);
\addplot3+[blue,dashed,samples y=0,domain=-pi:0] ({sin(deg(-x))},{cos(deg(x))},x);
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .