I need to draw one fairly complicated figure, consisting of several accurately placed ellipses and lines. So far I've been using tikz for drawing graphs and other simple objects, but in this case I have no idea where to start from. Since this looks pretty hard and long, I don't expect you to show me the code, but some guidelines would be more than welcomed. Below I post the figure (drawn by hand) and some explanations:

enter image description here

This is supposed to be a split tube with axis in its center. Also, along the tube in its core there are several identical curves. Basically, I need to draw 4 partial ellipses of appropriate sizes and translate them across the figure. Additionally, I need to draw 5-10 lines (which I assume is fairly easy) and close the inner little curves with semi-circles ideally. However, the hardest part seems to be erasing the parts of the ellipses which should not be visible.

If anyone can help with this, would highly appreciate it.

P.S. It is not necessary to use tikz, if there are better options, I would gladly go with them.

P.S.S. After using various sources and blindly tweaking parameters (we are still new with this), I and my co-worker managed to make this bare resemblance of the original picture:



\node[transform shape,ellipse,minimum height=2cm,minimum width=1cm,draw,outer sep=0]     (a) {}; 

\clip[scale=0.8,postaction={line width=0.8pt,draw}] (a) circle (0.5 and 1); 

\draw[scale=0.8] ([shift={($0.75*({cos(15)},{sin(15)})$)}]a) circle (0.5 and 1); 

\draw(a.west) -- (a.east); 



\draw (a.north) --  ++(0.75,0) arc (90:-90:0.5cm and 1cm-2\pgflinewidth) -- (a.south); 

\draw[->] (a.east) ++(0.75,0) -- ++(1cm,0); 

\draw (a.west) ++(-0.75,0) -- ++(0.9cm,0); 

\node at (-1,0.2) {$u'_0(t)$}; 



By the way for some reason the "ellipse" module doesn't work on my personal laptop (even though "circle" does), if someone can tell me why would be nice. Have no idea how to proceed further though and what need to learn in order to finish the picture.

  • I added some tex code, not very useful I guess though... – Puzzle Prime Sep 12 '15 at 0:19
  • Please don't quote code - it is really annoying to have to delete the > at the start of each line ;). If you highlight the code, hit ctrl+k or the {} button in the edit bar. This will indent the code by 4 spaces, which formats it correctly. – cfr Sep 12 '15 at 0:28
  • Great tip @cfr, will keep it in mind next time I post here:) – Puzzle Prime Sep 12 '15 at 0:29
  • 1
    Maybe you need 3D coordinates for this (<x>,<y>,<z>)? That is, maybe that would be easier? You need shapes.geometry and calc to be loaded for the code you posted to compile (plus a document class etc.). But I don't think that an ellipse-shaped node is going to be a very helpful way to think about this. Note that you can say \draw ellipse... just as you can \draw circle.... Though arcs may be more helpful, as you're doing? – cfr Sep 12 '15 at 0:42
  • Thanks @cfr, will definitely check this out. I see Lorehead offered something similar as well and it looks nice. – Puzzle Prime Sep 12 '15 at 16:33

Something a little like this, or did you want more complex walls?




\begin{axis}[trig format plots=rad,axis equal,
             xmin = -5, xmax = 5,
             ymin = -5, ymax = 5,
             zmin = -5, zmax = 5,
             axis x line = none, axis y line = none, axis z line = none,
%% Draw the back half of the tube:
  \addplot3[surf,variable=\t,variable y=\u,
             domain=-3:3,y domain=2*pi/3:3*pi/2,
             samples=4,samples y=15,
%% Draw an arrow:
    \draw[thick,->] (-5,0,0) -- (5,0,0);
%% Now, the front half of the tube:
  \addplot3[surf,variable=\t,variable y=\u,
             domain=-3:3,y domain=3*pi/2:7*pi/3,
             samples=4,samples y=15,





It’s been a while, but I saw this again and decided to go ahead and implement the suggestion to draw the tube in two halves, so that the arrow appeared at the proper z-level. It had always bugged me that I’d meant to but never had the chance.

| improve this answer | |
  • +1. A suggestion: to get the arrow right, you could plot half surface, draw the arrow and then plot the other half of the surface. That way the arrow would not be in the background as it is now and it would give some feeling of perspective. Just my two cents, :) – Pier Paolo Sep 12 '15 at 8:25
  • This looks really nice. As @cfr also suggested, 3D coordinates will be probably the way to go. Thank you for your time to draw this, will try to finish it and see how it goes. – Puzzle Prime Sep 12 '15 at 16:37
  • 1
    Thanks. I would work on it some more, but my box broke down last night. Bit of a problem, because the reason I had so much time to answer questions here is unemployment. – Davislor Sep 13 '15 at 2:36
  • 1
    @Pier Paulo That works (and I've done that before, but setting the z-buffering to sorted might work, too. Unfortunately, can't work on TeX at the moment.) – Davislor Sep 13 '15 at 2:43
  • 1
    That's the version string, so if your installation doesn't recognize it, either you're running an old version of pgfplots or something's misconfigured. – Davislor Sep 13 '15 at 18:35

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.