我对垂直线仍然有些困惑。这是我想复制的图形
这是我的 MWE
\documentclass[12pt,a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[dot/.style={circle,inner sep=1pt,fill,label={#1},name=#1},
extended line/.style={shorten >=-#1,shorten <=-#1},
extended line/.default=1cm]
\draw[extended line,thick,->] (-3.5,0) -- (4.5,0) node[anchor=north west] {\small spot 0};
\draw[extended line,thick,->] (0,-3.5) -- (0,4.5) node[anchor=south east] {\small spot 1};
\coordinate (A) at (0,4);
\coordinate (B) at (4,0);
\draw (A) -- (B)
node[pos=0.7,above=0.5em, font=\small]{$\Delta$};
\coordinate (C) at (0,0);
\coordinate (D) at (1.5,1.8);
\draw [thick, ->](C) -- (D)
node[pos=0.7,above=0.5em, font=\small]{$\Phi$};
\draw [dashed] (D)--(B) node[anchor= south west, font=\small]{$\delta^{0}$};
\draw (-3.5,-2)--(0,0)--(3.5,-2.5);
\fill[blue!10,fill opacity=0.3] (5,4.5) rectangle (0,0);
\end{tikzpicture}
\end{document}
我尝试在“圆锥”上添加一个坐标并使用语法calc
绘制一条垂直线,但它不起作用。我应该用它arc
来填充圆锥吗?谢谢您的时间。
答案1
像这样吗?
\documentclass[12pt,a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{calc,shadings}
\begin{document}
\begin{tikzpicture}[dot/.style={circle,inner sep=1pt,fill,label={#1},name=#1},
extended line/.style={shorten >=-#1,shorten <=-#1},
extended line/.default=1cm]
\draw[extended line,thick,->] (-3.5,0) -- (4.5,0) node[anchor=north west] {\small spot 0};
\draw[extended line,thick,->] (0,-3.5) -- (0,4.5) node[anchor=south east] {\small spot 1};
\shade[upper right=gray!20,lower left=gray,fill opacity=0.3] (5,4.5) rectangle (0,0);
\coordinate (A) at (0,4);
\coordinate (B) at (4,0);
\draw (A) -- (B)
node[pos=0.7,above=0.5em, font=\small]{$\Delta$};
\coordinate (C) at (0,0);
\coordinate (D) at (1.3,1.8);
\draw [thick, ->](C) -- (D)
node[pos=0.7,above=0.5em, font=\small]{$\Phi$};
\draw let \p1=($(D)-(C)$), \n1={atan2(\y1,\x1)-90}, \n2={\n1-120} in
[upper right=gray,lower left=gray!20,fill opacity=0.3,shading angle=\n1+60]
(\n1:4) coordinate (aux) -- (C) -- (\n2:4) arc(\n2:\n1:4);
\draw [dashed] (D)--(B) node[anchor= south west, font=\small]{$\delta^{0}$}
-- (intersection cs:first line={(B)--($(B)!3cm!90:(D)$)},
second line={(C)--(aux)});
\end{tikzpicture}
\end{document}
答案2
对所需图像的另一种近似(在一定程度上类似于@marmot 的回答):
\documentclass[12pt, tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,
calc,
backgrounds,
intersections,
shadings}
\begin{document}
\begin{tikzpicture}[
> = Straight Barb,
dot/.style = {circle,inner sep=1pt,fill,label={#1},name=#1},
every pin/.style = {pin edge={<-,line width=0.5pt,black},},
font = \small
]
\draw[->] (-4,0.0) -- (6,0) node[below left] {spot 0};
\draw[->] (0,-3.5) -- (0,5) node[below left] {spot 1};
\coordinate (A) at (0,4);
\coordinate (B) at (4,0);
\draw (A) -- node[coordinate,pin=45:$\Delta$] {} (B) ;
\coordinate (C) at (0,0);
\coordinate (D) at (1.5,1.8);
\draw[->](C) -- (D) node[left] {$\Phi$};
\draw[dashed] (D)--(B) node[above right]{$\delta^{0}$};
\draw[name path=A] (210:3.3) -- (0,0) -- (330:3.3);
\begin{scope}[on background layer]
\fill[top color=blue!30,bottom color=blue!5]
(0,0) -- (210:3.3) arc (210:330:3.3) -- (0,0);
\fill[lower left=blue!30, upper right=blue!5]
(4.5,4.5) rectangle (0,0);
\end{scope}
\path[name path=B] (B) -- ($(B)!22mm!90:(A)$);
\draw[name intersections={of=A and B,by=x},
dashed] (x) node[below] {$x^0$} -- (B);
\end{tikzpicture}
\end{document}
离题:使用extended line
如你的姆韦可能会使线溢出边界框,从而导致意外问题。而且节点的位置也不在绘制的线的末端,而是在给定的末端坐标。因此我没有使用这种线条样式。