Advertisement
cd62131

plot and fill region

Dec 16th, 2017
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 0.73 KB | None | 0 0
  1. \documentclass{article}
  2. \usepackage{pgfplots}
  3. \usepgfplotslibrary{fillbetween}
  4. \begin{document}
  5. \begin{figure}[!h]
  6. \centering
  7. \begin{tikzpicture}
  8. \begin{axis}[
  9.  axis x line=center,
  10.  axis y line=center,
  11.  xmin=-0.1,
  12.  xmax=1.1,
  13.  ymin=-0.1,
  14.  ymax=1.1,
  15.  xtick={1},
  16.  ytick={1},
  17.  xlabel=$x$,
  18.  ylabel=$y$,
  19.  x label style={anchor=west},
  20.  y label style={anchor=south}]
  21. \node[below] at (axis cs:0.02,0){$0$};
  22. \node[right] at (axis cs:0.75,0.5){$F(x)=x^2$};
  23. \node[left] at (axis cs:0.45,0.5){$G(x)=x$};
  24. \addplot[domain=-0.1:1.05, name path=A]{x^2};
  25. \addplot[domain=-0.1:1.1, name path=B]{x};
  26. \addplot[gray!50] fill between[of=A and B, soft clip={domain=0:1}];
  27. \end{axis}
  28. \end{tikzpicture}
  29. \end{figure}
  30. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement