在 TikZ 中重新创建阴极射线管图?

在 TikZ 中重新创建阴极射线管图?

有人可以帮我在 TikZ 中制作这个图表吗?enter image description here

这是我现在拥有的代码。

\begin{tikzpicture}
\draw (3.5, 3.5) circle (130 pt);

\draw[blue, very thick] (-1, 3.5) parabola (5.5, 1.5);
\draw[blue, very thick] (-2.5, 3.5) -- (-1, 3.5);
\draw (5.5, 1.5) node [anchor=north] {$(x, y)=O$};
\draw [black, very thick] (5.5, 1.5) circle (2 pt); 
\draw [black, very thick] (-1, 1.5) circle (2 pt);
\draw (-1, 1.5) node [anchor= north east] {$B$};
\draw [red, very thick] (-1, 1.5) -- (5.5, 1.5);
\draw [red, very thick] (-1, 1.5) -- (-1, 3.5);
\draw [very thick] (-1, 1.8) -- (-0.7, 1.8);
\draw [very thick] (-0.7, 1.8) -- (-0.7, 1.5);
\draw [very thick] (-1, 1.8) -- (-1, 1.5);
\draw [very thick] (-1, 1.5) -- (-0.7, 1.5);
\draw (-1, 1.5) -- (-1, -6) node[near end, left] {$R-y$};
\draw (-1, -6) -- (5.5, 1.5) node[near start, below] {$R$};
\draw [very thick] (-1, -6) circle (2 pt);
\draw (-1, -6) node [anchor=north east] {$E$};
\foreach \x in {1,...,6}
\foreach \y in {1,...,6}
{
\draw (\x,\y) +(-.5,-.5) rectangle ++(.5,.5);

}
\end{tikzpicture}

答案1

我尝试了很多评论,如果有什么不清楚的,请随时询问:

代码

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}

\begin{tikzpicture}
    % replace nested foreach by grid; also draw it earlier so it does not paint over the red line
    \draw (1,1) grid[shift={(-0.5,-0.5)}] (7,7);

    %  put a coordinate in the end for reference
    \draw [very thick] (5.5, 1.5) circle (2 pt) coordinate (myOrigin); 

    % also a coordinate here
    \draw [very thick] (-1, 1.5) circle (2 pt) coordinate[label=180:B] (myB);
    \draw [very thick] (-1, -6) circle (2 pt) coordinate[label=270:E] (myE);

    % try not to mix units (e.g. cm/pt); use arcs to construct the curved part
    \draw (-5.3,4) -- (-1.3,4) arc (270:360:0.3) arc (170:-170:4.5) arc (0:90:0.3) -- ++ (-4,0);

    % draw red line with the "first vertical, then horizontal" notation; put another coordinate
    \draw [red, very thick]  (-1, 3.5) coordinate (myA) |- (myOrigin);

    % you can draw the whole blue line in one command, use coordinate
    \draw[blue, very thick] (myA) -- (-1.5,3.5) (-1, 3.5) parabola (myOrigin);

    % imho looks better outside; stealth is an arrow tip
    \draw[stealth-,shorten <=2mm] (myOrigin) -- ++(-30:2cm) node[below right] {$(x, y)=O$};

    % use rectangle operation instead of 4 draw commands
    \draw[very thick] (-1,1.5) rectangle (-0.7,1.8);

    % use coordinates and "pos" key
    \draw (myE) -- (myB) node[left,pos=0.5] {$R-y$};
    \draw (myE) -- (myOrigin) node[below right,pos=0.5] {$R$};

    % draw the ?electron source?
    \foreach \x in {0,1,2}
    {   \fill[gray] (-1.5-\x/5,3.85) rectangle (-1.6-\x/5,3.2);
    }
    \draw (-2.1,3.2) rectangle (-1.5,3.85);

    % draw the ?heater?
    \draw[thick] (-2.3,3.55) arc (0:135:0.3) -- ++ (225:0.8);
    \draw[thick] (-2.3,3.55) arc (0:-135:0.3) -- ++ (-225:0.8);

    % gray filling
    \fill[gray] (-5.3,3.1) rectangle (-3.3,3.95);

    %decription arrows
    \draw[stealth-,shorten <=1mm] (myA) -- ++ (-0.5,2.5) node[above] {A};
\end{tikzpicture}

\end{document}

输出

enter image description here

相关内容