Skip to content

Instantly share code, notes, and snippets.

@alstat alstat/pca1.tex
Last active Aug 29, 2015

Embed
What would you like to do?
\documentclass{article}
\usepackage{tikz, pgfplots}
\usetikzlibrary{calc}
\begin{document}
\centering
\begin{tikzpicture}
\coordinate (Origin) at (0,0);
\coordinate (XAxisMin) at (-0.5,0);
\coordinate (XAxisMax) at (2.5,0);
\coordinate (YAxisMin) at (0,-0.5);
\coordinate (YAxisMax) at (0,4.5);
\coordinate (PStart) at (-1.5,4);
\coordinate (PEnd) at (6, 4);
\coordinate (kuStart) at (0, 4);
\coordinate (kuEnd) at (5, 4);
\coordinate (uEnd) at (2, 0);
\coordinate (xPoint) at (2, 6);
\draw [->, thin, gray] (XAxisMin) -- (XAxisMax);% Draw x axis
\draw [->, thin, gray] (YAxisMin) -- (YAxisMax);% Draw y axis
\draw [black] (PStart) -- (PEnd) node at (-1.3,4.25) {$L$};
\draw [red, ultra thick, -latex] (kuStart) -- (kuEnd);
\draw [red, ultra thick, -latex] (Origin) -- (kuStart)
node [black] at (-0.25, 2) {$\mathbf{v}$};
\draw [red, ultra thick, -latex] (Origin) -- (kuEnd)
node [black, rotate = 38] at (2.2, 2.1) {$(\mathbf{u}^T\mathbf{x})\cdot \mathbf{u} + \mathbf{v}$};
\draw [red, ultra thick, -latex] (Origin) -- (uEnd)
node [black] at (2, -0.25) {$\mathbf{u}$};
\draw [black, dashed] (xPoint) -- (2, 4)
node at (2.25, 6) {$\mathbf{x}$};
\filldraw [red] (xPoint) circle (2pt);
\draw (2, 4) rectangle (2.2, 4.2);
\draw [->] (2, 4) .. controls (2.5, 5.5) and (3.5, 5.9) .. (4, 6)
node[right] {$Proj = (\mathbf{u}^T\mathbf{x})\mathbf{u}$};
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.