![如何使用 Tikz 完成这个复杂的情节?](https://linux22.com/image/348000/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20Tikz%20%E5%AE%8C%E6%88%90%E8%BF%99%E4%B8%AA%E5%A4%8D%E6%9D%82%E7%9A%84%E6%83%85%E8%8A%82%EF%BC%9F.png)
再一次,我试图在 tikz 中得到一个相当复杂的图形,但我做不到。这是我想要的输出:
这是我迄今为止最好的尝试:
这是我最好的(但很差的)尝试的 MWE:
\documentclass[dvipsnames]{standalone}
\usepackage{tikz,siunitx}
\usetikzlibrary{fit, calc, matrix, positioning, arrows.meta, intersections, through, backgrounds, patterns}
\begin{document}
\begin{tikzpicture}[node distance = 0pt, every pin/.style = {pin distance=11mm, pin edge={stealth-}}, every node/.style = {color=Blue!60!black}, dot/.style = {circle, fill=black, inner sep=0mm, minimum size=2mm, node contents={}}, line/.style = {-stealth, shorten >=1mm, shorten <= 1mm},]
\coordinate (O) at (0,0);
\coordinate[right=55mm of O] (X);
\coordinate[above=55mm of O] (Y);
\coordinate[above right=1 and 2 of O] (d);
\coordinate[right=2 of X |- Y] (e);
\coordinate (a) at (10,10);
\draw[-latex] ([xshift=-0.1] O) -- (X) node[right] {$h_1$};
\draw[-latex] ([yshift=-0.1] O) -- (Y) node[above] {$h_2$};
\draw[Blue, thick, scale=0.9,name path=B] ($(e)-(5.4,0)$) arc(180:270:5.5 and 4.4);
\path[name path=S] (O) -- (45:6);
\path[name intersections={of=B and S, by={s}}];
\coordinate[left =of s -| O] (s1);
\coordinate[below=of s |- O] (s2);
\draw[red,thick] let \p1 = ($(s)-(O)$), \n1 = {veclen(\x1,\y1)} in ($(O)+(\n1,0)$) arc(0:90:\n1);
\draw[densely dotted] (s1) -| (s2) node [pos=0.25,above] {$S^{\prime}$};
\node[dot,at=(s),pin=60:{$F(S^{\prime},d^{\prime})=(1,...,1)$}];
\path[name path=D] (s2) -- (15:8);
\draw[-] (0,0) -- (3.5,3.5);
\node [left] at (s1) {$1$};
\node [below] at (s2) {$1$};
\node [below] at (0,0) {$d^{\prime}=0$};
\node [right, yshift=-2.5pt] at (3.5,3.5) {$45\si{\degree}$};
\node [right] at (7.5,1.55) {$y_1y_2=1$};
\end{tikzpicture}
\end{document}
有人能帮我得到想要的输出吗?谢谢大家的时间!:)
答案1
制作该矩形的一个非常简单的方法是node
使用
\node[draw,minimum width=10cm,minimum height=6cm,anchor=north,rotate=-45] (rec) at (s) {};
然后可以在末尾添加带有文本的箭头
\draw [latex-] (rec.40) -- +(1cm,0) node[right] {$T = \{ y \in \mathbb{R}^{n} \mid \sum\limits_{i=1}^{n}y_{i} = n\}$};
\documentclass[dvipsnames,border=4mm]{standalone}
\usepackage{tikz,siunitx}
\usepackage{amsmath,amssymb}
\usetikzlibrary{fit, calc, matrix, positioning, arrows.meta, intersections, through, backgrounds, patterns}
\begin{document}
\begin{tikzpicture}[node distance = 0pt, every pin/.style = {pin distance=11mm, pin edge={stealth-}}, every node/.style = {color=Blue!60!black}, dot/.style = {circle, fill=black, inner sep=0mm, minimum size=2mm, node contents={}}, line/.style = {-stealth, shorten >=1mm, shorten <= 1mm},]
\coordinate (O) at (0,0);
\coordinate[right=55mm of O] (X);
\coordinate[above=55mm of O] (Y);
\coordinate[above right=1 and 2 of O] (d);
\coordinate[right=2 of X |- Y] (e);
\coordinate (a) at (10,10);
\draw[-latex] ([xshift=-0.1] O) -- (X) node[right] {$h_1$};
\draw[-latex] ([yshift=-0.1] O) -- (Y) node[above] {$h_2$};
\draw[Blue, thick, scale=0.9,name path=B] ($(e)-(5.4,0)$) arc(180:270:5.5 and 4.4);
\path[name path=S] (O) -- (45:6);
\path[name intersections={of=B and S, by={s}}];
\coordinate[left =of s -| O] (s1);
\coordinate[below=of s |- O] (s2);
\draw[red,thick] let \p1 = ($(s)-(O)$), \n1 = {veclen(\x1,\y1)} in ($(O)+(\n1,0)$) arc(0:90:\n1);
\draw[densely dotted] (s1) -| (s2) node [pos=0.25,above] {$S^{\prime}$};
\node[dot,at=(s),pin=60:{$F(S^{\prime},d^{\prime})=(1,...,1)$}];
\path[name path=D] (s2) -- (15:8);
\draw[-] (0,0) -- (3.5,3.5);
\node [left] at (s1) {$1$};
\node [below] at (s2) {$1$};
\node [below] at (0,0) {$d^{\prime}=0$};
\node [right, yshift=-2.5pt] at (3.5,3.5) {\SI{45}{\degree}};
\node [right] at (7.5,1.55) {$y_1y_2=1$};
\node[draw,minimum width=10cm,minimum height=6cm,anchor=north,rotate=-45] (rec) at (s) {};
\draw [latex-] (rec.40) -- +(1cm,0) node[right] {$T = \{ y \in \mathbb{R}^{n} \mid \sum\limits_{i=1}^{n}y_{i} = n\}$};
\end{tikzpicture}
\end{document}