[Tex/LaTex] Drawing cylinder in 3D plane


Can someone help me write the tikz code to generate the following images? I've tried adapting what some other people have done to generate a cylinder, but I want the cylinder with the axes and with the smaller cylinder inside. enter image description here

The code written here is perhaps most useful, Concentric Cylinders with tikz

The code for a basic cylinder is given here 3D bodies in TikZ

I'm new to tikz and have found that upon editing, the lines and dimensions go out of proportion and don't look reasonable any more. I also don't understand how to include lines in these cylinders or how to shade the inside cylinder.

Best Answer

It really isn't clear what you've tried or what the problem is. This is almost, therefore, a do-it-for-me and I, therefore, hold that I shouldn't answer it.

As a do-it-for-me, remaining adjustments are left entirely as an exercise for the reader. I will be less sympathetic to requests for fine-tuning and explanation than I would otherwise be.

I answer do-it-for-mes strictly for me. If it happens to be useful, so be it. If not, so be it.

The most useful code you said you found is for a question where the answer does not even use TikZ. I'm not clear whether you were aware of this or not ....

  \draw [fill=gray, fill opacity=.25]
  (180:5mm) coordinate (a)
  -- ++(0,-12.5mm) coordinate (b)
  arc (180:360:5mm and 1.75mm) coordinate (d)
  -- (a -| d) coordinate (c) arc (0:180:5mm and 1.75mm);
  \draw [fill=gray, fill opacity=.25]
  (0,0) coordinate (t) circle (5mm and 1.75mm);
  \draw [densely dashed] (d) arc (0:180:5mm and 1.75mm);
  \draw []
  (180:7.5mm) coordinate (A)
  -- ++(0,-12.5mm) coordinate (B) node [midway, right, inner sep=1pt] {$v$}
  arc (180:360:7.5mm and 2.625mm) coordinate (D)
  -- (A -| D) coordinate (C) arc (0:180:7.5mm and 2.625mm);
  \draw []
  (0,0) coordinate (T) circle (7.5mm and 2.625mm);
  \draw [densely dashed] (D) arc (0:180:7.5mm and 2.625mm);
  \draw [densely dashed ]
  ([yshift=-12.5mm]T) coordinate (B)
  edge [-Latex] node [pos=1, right] {$y$} +(-30:7.5mm)
  edge [-Latex] node [pos=1, left] {$x$} +(-150:7.5mm)
  -- (T) node [midway, right, anchor=west, fill=white, inner sep=.5pt] {$w$} node [anchor=center, circle, draw, solid, inner sep=.5pt, fill=white] {} edge [solid, -Latex] node [right, pos=1] {$z$} ++(0,5mm) ;