\documentclass[10pt,border=3mm,tikz]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% arc
\draw
(-0.15,0.3) % Coordinates of the arc center (x, y)
arc (30:150:1); % Starting angle: 30 degrees, Ending angle: 150 degrees, Radius: 1
% Vertical line
\draw
(-1,2) % Initial coordinates (x, y)
-- % Operator for drawing a line
(-1,0.1); % Final coordinates (x, y)
% Horizontal line
\draw
(-1.4,0.1) % Initial coordinates (x, y)
-- % Оператор для рисования линии
(-0.6,0.1); % Final coordinates (x, y)
% Axes
\draw[->] (-1.5,0) -- (1.5,0) node[right] {$x$};
\draw[->] (0,-1.5) -- (0,1.5) node[above] {$y$};
\end{tikzpicture}
\end{document}
需要绘制完整的图画,但是到目前为止我刚刚启动发射器,不知道如何正确设置坐标以及如何使其更加相似。
几个小时后,我收到了这样一张图纸。当然,它看起来和原图太不相似了:
\documentclass[10pt,border=3mm,tikz]{standalone}
\begin{document}
\tikzset{
mylabel/.style={font=\scriptsize}
}
\begin{tikzpicture}[
antenna/.pic={
% Antenna drawing
\draw (-0.57,.15) arc(50:130:0.7);
\draw (-1,1) -- (-1,.1);
\draw (-1.2,.1) -- (-0.8,.1);
},
Pattern/.pic={
% Radiation pattern drawing
\draw[thick] (0,0) ellipse (0.1 and 0.5);
\draw[dashed] (0,\R) -- (0,0);
}
]
% Positions of emitters and axis labels
\def\positionOne{-1}
\def\positionZero{0}
\def\positionTwo{1}
\def\R{2} % R
\def\alpha{18} % Angle
% Placement of emitters and radiation pattern
\pic at (\positionOne+1,0.3) {antenna};
\node[below, mylabel] at (\positionOne+0.5,1.2) {№ 1};
\pic at (\positionTwo+1,0.3) {antenna};
\node[below, mylabel] at (\positionTwo+0.5,1.2) {№ 2};
\pic[rotate=-\alpha,scale=1, red!100] at (\positionZero,-\R) {Pattern};
\draw[dashed] (\positionZero,-\R) -- (\positionZero,0);
\node[below, mylabel] at (\positionZero-0.25,-\R/3) {R};
\draw[dashed] (\positionZero,-\R) -- (\positionTwo,0);
% Axes
\draw[->] (\positionOne-0.5,0) -- (\positionTwo+0.5,0) node[right] {$X$};
% Labels on the axis
\node[below, mylabel] at (\positionOne,0) {$\positionOne$};
\node[below, mylabel] at (\positionZero,0) {$\positionZero$};
\node[below, mylabel] at (\positionTwo,0) {$\positionTwo$};
% Ticks on the axis
\foreach \x in {\positionOne,\positionZero,\positionTwo}
\draw (\x,0.1) -- (\x,-0.1);
\end{tikzpicture}
\end{document}
答案1
嗯,代码在你的环境中编译了吗?在我的环境中可以编译,只要我:
- 变成
\Draw
\draw
- 将两个坐标
.
转换为,
- 开始使用正确的立场声明和节点
- 查看
% <<<
标记
也很难说清,你取得了什么成就,因此你在哪里遇到困难,请参见下面的屏幕截图。
建议:
- 审查手册经常这样做是个好主意,包括我自己
- 审查
\node
- 寻找极坐标
- 考虑使用
\pic
天线 - 稍后:查看上述手册中的角度库
\documentclass[10pt,border=3mm,tikz]{standalone}
至少用于开发
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% Arc
\draw % <<<
(-(-0,15,0,3) % Arc modifier (x,y)
arc (30:150:1); % Starting angle: 0 degrees, Ending angle: 45 degrees, Radius: 1
% Vertical line
\draw
(-1,2) % Initial values (x, y) % <<<
-- % Line drawing operator
(-1,0.1); % Final values (x, y) % <<<
% Horizontal line
\draw
(-1.4,0.1) % Initial values (x, y)
-- % Line drawing operator
(-0,6,0,1); % Final values (x, y)
% of the Axis
\draw[->] (-1.5,0) -- (1.5,0) node[right] {$x$}; % <<<
\draw[->] (0,-1.5) -- (0,1.5) node[above] {$y$}; % <<<
\end{tikzpicture}
\end{document}
答案2
这是一个调整后的示例,说明您如何做到这一点,假设您不将其用于军事发展(!)。
必须重新输入部分文本,这可能是由于使用的字符系统不同。
一些提示:
- 当旋转天线时,你会发现它的固定点并不在你期望的位置:天线细节的偏移坐标
- 查看手册中的语法,这将简化此类
+
绘图++
- 轴很容易创建;把它们变成
\pic
可能有点过头了
\documentclass[10pt,border=3mm,tikz]{standalone}
\begin{document}
\begin{tikzpicture}[
antenna/.pic={
\draw (-.15,.3) arc(30:150:1);
\draw (-1,2) -- (-1,.1);
\draw (-1.4,.1) -- (-.6,.1);
}
]
% ~~~ placing some antennas ~~~~~~~~~~
\pic at (0,2) {antenna};
\pic[red!40] at (3,2) {antenna};
\pic[rotate=30,scale=.5,thick,dashed] at (5,2) {antenna};
% Axes
\draw[->] (-1.5,0) -- (1.5,0) node[right] {$x$};
\draw[->] (0,-1.5) -- (0,1.5) node[above] {$y$};
\end{tikzpicture}
\end{document}