TransWikia.com

Drawing a cylinder inside a 3D frame

TeX - LaTeX Asked on April 18, 2021

There are many questions related to cylinders but mine is a little different. I would like to draw a cylinder inside a 3D frame as shown. I want to keep the 3D planes the way they are shown. However, I am unable to move the green cylinder to other positions and to change the cylinder size. I can also draw a parametric cylinder but its surface is meshed or "grid-ified" which I don’t want. Is there a way to change the size/location of the green cylinder or remove the grids on the parametric cylinder and change its size?

documentclass{article}
usepackage{tikz} 
usepackage{pgfplots}
usetikzlibrary{shapes.geometric} 

begin{document}

begin{figure}
centering
begin{tikzpicture}
begin{axis}[axis equal]
addplot3 [surf,
   colormap/hot2, %colour scheme
   domain=0:360, %sets range for x
   y domain=0:1, %sets range for y
   samples=20, %number of samples taken
   z buffer=sort]
(
{cos(x)},
{sin(x)},
{y}
);

node[cylinder, draw, shape aspect=.5, 
  cylinder uses custom fill, cylinder end fill=green!50, 
  minimum height=1cm,
  cylinder body fill=green!25, opacity=0.5, 
  scale=3, rotate=90]  {};
end{axis}
end{tikzpicture}
end{figure}

end{document}

cylinder

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP