5

I drew a plate like the below picture enter image description here

but I have two problem with it

1) The inner hole should be improved like the bellow picture (it have color and layer) enter image description here

2) Also, a number of layers should be added to picture in thickness direction (like the below picture). it is good if I can change the color of each layer. enter image description here

    \documentclass[12pt,tikz,border=2pt]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{calc}‎
\definecolor{mycolor}{rgb}{0,0.77,1}
\begin{document}
\tikzset
{
  coating/.style={fill=mycolor},
}
\def\angThe{40}
\def\angPhi{50}
\tdplotsetmaincoords{\angThe}{\angPhi}
\begin{tikzpicture}[scale=4,tdplot_main_coords]
  \def\R{1}     % radius of the inner plate
  \def\RR{2.2}  % outer radius
  \def\OC{1.5}  % Eccentricity of holes
  \def\z{1}     % thickness of the cake‎

  % translation vector between plates
  \coordinate (vert) at (0,0,\z); 
  \begin{scope}[shift={(vert)}]
    \draw [coating] (\RR,0) arc (0:360:\RR) -- (360:\OC) arc (360:0:\R) -- cycle;
  \end{scope}
  \draw (\angPhi:-\RR) -- ++ (vert) 
         (\angPhi:\RR) -- ++ (vert);
  \draw(\RR,0) arc (0:-130:\RR);‎
    \draw(\RR,0) arc (0:50:\RR);
\end{tikzpicture}
\end{document}
  • TikZ is really not the right too for this .... At least, not the easiest/best. I have no idea what 'the laminated layer' refers to. – cfr Dec 17 '17 at 2:02
  • Laminated Layer: If in thickness direction we have three layer and each layer have a color. – sayros Dec 17 '17 at 2:08
  • Also, I have seen many beautiful circular plate via Tikz. like as tex.stackexchange.com/questions/385943/… tex.stackexchange.com/questions/158668/… – sayros Dec 17 '17 at 2:12
  • The only way I can count layers is that there are 6, but I don't know which is laminated. – cfr Dec 17 '17 at 2:20
  • OK, my mean is the number of layer in thickness direction. I will edit the question now. – sayros Dec 17 '17 at 2:22
11

If realism isn't a desiderata, you might try something like this:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
  \foreach \i in {0,2,4,...,15}
  {
    \scoped[yshift=\i mm] \draw [draw=blue!10!black, preaction={fill=blue!50!cyan, even odd rule}, left color=black, right color=black, middle color=white, shading=axis, opacity=.5, even odd rule] circle (5 and 3) circle (2.5 and 1.5);
  }
\end{tikzpicture}
\end{document}

stacked disk-ish things

Now for some colour ...

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
% xcolor manual: 34
\definecolorseries{colours}{hsb}{grad}[hsb]{.575,1,1}{.987,-.234,0}
\resetcolorseries[12]{colours}
\begin{document}
\begin{tikzpicture}
  \foreach \i in {0,2,4,...,25}
  {
    \color{colours!!+}
    \scoped[yshift=\i mm] \draw [draw=blue!10!black, preaction={fill, even odd rule}, left color=black, right color=black, middle color=white, shading=axis, opacity=.5, even odd rule] circle (5 and 3) circle (2.5 and 1.5);
  }
\end{tikzpicture}
\end{document}

coloured disk-ish things

If you want to xshift the inner circles by, say, 5mm, just use a coordinate before cutting out the inner circle. For example,

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
% xcolor manual: 34
\definecolorseries{colours}{hsb}{grad}[hsb]{.575,1,1}{.987,-.234,0}
\resetcolorseries[12]{colours}
\begin{document}
\begin{tikzpicture}
  \foreach \i in {0,2,4,...,25}
  {
    \color{colours!!+}
    \scoped[yshift=\i mm] \draw [draw=blue!10!black, preaction={fill, even odd rule}, left color=black, right color=black, middle color=white, shading=axis, opacity=.5, even odd rule] circle (5 and 3) (5mm,0) circle (2.5 and 1.5);
  }
\end{tikzpicture}
\end{document}

coloured disk-ish things with shifted cut-outs

EDIT

Here's a customisable version which also shows how to vary the shading angle to gesture towards differently positioned light sources (sort of).

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
% xcolor manual: 34
\definecolorseries{colours}{hsb}{grad}[hsb]{.575,1,1}{.987,-.234,0}
\resetcolorseries[12]{colours}
\tikzset{
  stacked layers/.search also={/tikz},
  stacked layers/.cd,
  layers/.store in=\layersno,
  shading angle/.store in=\layerssa,
  layer height/.store in=\layersht,
  outline/.code={
    \colorlet{layers outline colour}{#1}
  },
  outer circle/x/.store in=\layersocx,
  outer circle/y/.store in=\layersocy,
  outer circle/.code args={#1 and #2}{
    \tikzset{
      stacked layers/outer circle/.cd,
      x=#1,
      y=#2,
    }%
  },
  inner circle/x/.store in=\layersicx,
  inner circle/y/.store in=\layersicy,
  inner circle/.code args={#1 and #2}{
    \tikzset{
      stacked layers/inner circle/.cd,
      x=#1,
      y=#2,
    }%
  },
  inner circle/x shift/.store in=\layersicshiftx,
  inner circle/y shift/.store in=\layersicshifty,
  inner circle shift/.code args={#1 and #2}{
    \tikzset{
      stacked layers/inner circle/.cd,
      x shift=#1,
      y shift=#2,
    }%
  },
  colours set/.code={
    \resetcolorseries[#1]{colours}%
  },
  layers/.forward to=/tikz/stacked layers/colours set,
  layers=12,
  outer circle=5 and 3,
  inner circle=2.5 and 1.5,
  inner circle shift=0pt and 0pt,
  shading angle=90,
  outline=blue!10!black,
  layer height=2mm,
  /tikz/.cd,
  stack layers/.pic={
    \tikzset{
      stacked layers/.cd,
      #1,
    }
    \pgfmathsetmacro\layerssteps{int((2*\layersno)+1)}
    \foreach \i in {0,...,\layersno}
    {
      \color{colours!![\i]}
      \scoped[yshift=\i*\layersht] \draw [draw=layers outline colour, preaction={fill, even odd rule}, left color=black, right color=black, middle color=white, shading=axis, shading angle=\layerssa, opacity=.5, even odd rule] circle ({\layersocx} and {\layersocy}) (\layersicshiftx,\layersicshifty) circle ({\layersicx} and {\layersicy});
    }
  },
}
\begin{document}
\begin{tikzpicture}
  \pic {stack layers};
  \pic at (9,0) {stack layers={layers=20, shading angle=115, outline=gray, layer height=3mm, outer circle=4 and 2.5, inner circle=2.75 and 1.8, inner circle shift=5mm and 2.5mm}};
  \pic at (4.5,-6) {stack layers={layers=15, shading angle=125, inner circle shift=-5mm and 0pt}};
\end{tikzpicture}
\end{document}

stacked layers variations

stack layers is a pic which accepts one optional argument. If used, this argument should consist of key-value pairs to be passed to \tikzset. The following keys are recognised. Other keys will be passed to TikZ and may or may not have any effect and may or may not give weird results. Default values are given in parentheses.

  • layers=<positive integer> specifies the number of layers (12);
  • layer height=<dimension> specifies the height of each layer (2mm);
  • outer circle=<x> and <y> specifies the width and height of the outer border of each layer (5 and 3);
  • inner circle=<x> and <y> specifies the width and height of the inner border of each layer (2.5 and 1.5);
  • inner circle shift=<x> and <y> specifies the horizontal and vertical offset of the inner border of each layer (0pt and 0pt);
  • shading angle=<angle in degrees> specifies the angle of the shading (90);
  • outline=<colour> specifies the angle used to draw the outline of each layer.

The colours used to fill the layers are derived from the colour series colours (as before) and the number of layers. So if there are more layers, the colours will change more slowly from layer to layer; fewer layers means fewer colours and more rapid changes.

  • Tank you, it is very nice. just It is possible to xshift the inner circles? – sayros Dec 17 '17 at 4:17
  • 1
    @sayros Like this? ^^ – cfr Dec 17 '17 at 4:23
  • Ok,Tank you , that is right. – sayros Dec 17 '17 at 4:34
  • 1
    @sayros Please see edit above for a pic version which allows you to tweak various things more easily. – cfr Dec 18 '17 at 0:22
3

It is rather straightforward to draw something of that sort.

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}

\begin{tikzpicture}
\draw[fill=red!40] (0,0) circle [x radius=4,y radius=1];
\fill[red!40] (-4,0) rectangle (4,1);
\draw[fill=blue!40] (0,1) circle [x radius=4,y radius=1];
\fill[blue!40] (-4,1) rectangle (4,2);
\draw[fill=red!40] (0,2) circle [x radius=4,y radius=1];
\fill[red!40] (-4,2) rectangle (4,3);
\draw[fill=blue!40] (0,3) circle [x radius=4,y radius=1];
\fill[blue!40] (-4,3) rectangle (4,4);
\draw[fill=red!40] (0,4) circle [x radius=4,y radius=1];
\fill[red!40] (-4,4) rectangle (4,5);
\draw[fill=blue!40] (0,5) circle [x radius=4,y radius=1];
\fill[blue!40] (-4,5) rectangle (4,6);
\draw[fill=blue!50] (0,6) circle [x radius=4,y radius=1];
\draw[fill=blue!65] (0.5,5.75) circle [x radius=2,y radius=0.5];
\pattern[pattern=vertical lines] (0.5,5.75) circle [x radius=2,y radius=0.5];
\end{tikzpicture}
\end{document}

enter image description here

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.