-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhard-margin.tex
More file actions
83 lines (70 loc) · 2.07 KB
/
hard-margin.tex
File metadata and controls
83 lines (70 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
\RequirePackage{luatex85}
\documentclass{standalone}
\usepackage{xparse}
\usepackage{amsmath}
\newcommand{\vectorunit}[1]{\hat{\mathbf{#1}}}
\NewDocumentCommand\norm{ o m }{\|\mathbf{#2}\|\IfNoValueF{#1}{_{#1}}}
\usepackage{fontspec, unicode-math}
\setsansfont[Scale=MatchLowercase]{TeX Gyre Heros}
\setmathfont{TeX Gyre Termes Math}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\tikzset{
every picture/.style={font={\sffamily\normalsize}, >=stealth},
every pin edge/.style={black}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
axis equal image,
axis lines=center,
xmax = 9,
xmin = -0.5,
ymax = 7,
ymin = -0.5,
xtick = \empty,
ytick = \empty,
no markers]
\addplot[dashed, ->] coordinates {(0, 0) (11/5, 22/5)}
node[midway, left=5pt]{$b$};
\addplot[thick, ->] coordinates {(0, 0) (0.4472, 0.8944)}
node[below right]{$\vectorunit{w}$};
\addplot[dashed, <->] coordinates {(6.6, 1.2) (7.4, 2.8)}
node[right=10pt, above]{$\frac{2}{\norm{w}}$};
\addplot[black, thin, domain=1:7] {(9 - x) / 2}
node[pos=0.05, sloped, above] {\tiny $D_{-}$};
\addplot[black, thick, domain=(7/5):(37/5)] {(11 - x) / 2}
node[pos=0.025, sloped, above] {\tiny $D$};
\addplot[black, thin, domain=(9/5):(39/5)] {(13 - x) / 2}
node[pos=0.05, sloped, above] {\tiny $D_{+}$};
\addplot[
scatter,
only marks,
point meta=explicit symbolic,
scatter/classes={
a={mark=*},
b={mark=*, draw=black, fill=white},
v={mark=o, draw=darkgray, thick, scale=2.25}
}]
table[meta=label] {
x y label
4 6 a
5 4 a
5.5 5 a
6.5 5 a
7 3.5 a
7 5.5 a
1 3 b
1.5 0.5 b
2 2.5 b
3 3 b
4 1 b
5 2 b
3 3 v
5 2 v
5 4 v
};
\end{axis}
\end{tikzpicture}
\end{document}