15

One more time, I am trying to get a rather complex figure in tikz and I can't. This is the output I desire:

enter image description here

This is my best attempt so far:

enter image description here

And this is the MWE of my best (yet poor) attempt:

\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}

Could anyone help me get the desired output? Thank you all for your time! :)

1
  • 1
    I would recommend trying ctan.org/pkg/tkz-euclide to handle tangent circles and such - it has many illustrated examples.
    – meduz
    Commented Jan 25, 2017 at 11:12

1 Answer 1

21

One quite easy way of making that rectangle is to add a rotated node using

\node[draw,minimum width=10cm,minimum height=6cm,anchor=north,rotate=-45] (rec) at (s) {};

The arrow with text at the end can then be added with

\draw [latex-] (rec.40) -- +(1cm,0) node[right] {$T = \{ y \in \mathbb{R}^{n} \mid \sum\limits_{i=1}^{n}y_{i} = n\}$};

enter image description here

\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}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .