Last active
August 29, 2015 14:08
-
-
Save alstat/aef57fc8bbf4f7056afb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\usepackage{pgfplots} | |
\usepackage{tikz} | |
\pgfplotsset{compat=1.5.1} | |
\begin{document} | |
\begin{figure} | |
\begin{tikzpicture} | |
\begin{axis}[ | |
ticks=none, | |
axis lines = middle, | |
axis line style={->}, | |
ymin=-1.3, ymax = 1.3, | |
xmin=-1.3, xmax=1.3, | |
xlabel={$x$}, | |
ylabel={$y$}, | |
axis equal image, | |
samples = 500 | |
] | |
\addplot[black, | |
fill = blue, | |
fill opacity = 0.5, | |
domain = -1.3:1.3] {1 - x}; | |
\addplot[black, | |
fill = blue, | |
fill opacity = 0.5, | |
domain = -1.3:1.3] {-1 - x}; | |
\node [rotate = -45] at (axis cs:0.6,0.6) {$y=1-x$}; | |
\node [rotate = -45] at (axis cs:-0.4,-0.4) {$y=-1-x$}; | |
\draw[dashed, | |
fill = blue, | |
fill opacity = 0.5] (axis cs:0,1) -- (axis cs:-1,1) -- (axis cs:-1,0) -- (axis cs:0,-1) -- (axis cs:1,-1) -- (axis cs:1,0) -- (axis cs:0,1); | |
\addplot[red, | |
mark = *, | |
only marks] coordinates {(-1,1) (1,1) (1,-1) (-1,-1)}; | |
\addplot[mark = ""] coordinates {(-1, 1)} node[above] {(-1,1)}; | |
\addplot[mark = ""] coordinates {(1, 1)} node[above] {(1,1)}; | |
\addplot[mark = ""] coordinates {(-1, -1)} node[below] {(-1,-1)}; | |
\addplot[mark = ""] coordinates {(1, -1)} node[below] {(1,-1)}; | |
\draw[dashed] (axis cs:-1,-1) -- (axis cs:0,-1) -- (axis cs:-1,0) -- (axis cs:-1,-1); | |
\draw[dashed] (axis cs:1,1) -- (axis cs:1,0) -- (axis cs:0,1) -- (axis cs:1,1); | |
\end{axis} | |
\end{tikzpicture} | |
\end{figure} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment